deploying-with-now
deploying-with-now copied to clipboard
A simple node server demo for deploying with https://zeit.co/now.
Deploying with now
This documents how to deploy a simple node app to https://zeit.co/now, set up alias, and configure environment variables. Check out this test site at https://muan-testing.now.sh.
Steps
-
Fork this repository or have your project ready with
npm startscript and these configurations in yourpackage.json. -
Get an account at https://zeit.co/login.
-
Install now CLI with
npm install now -g. -
Authenticate and deploy with
now --public. -
Set an environment variable with
now secrets [name] [value]. -
Alias deployment with
now ln. -
:tada:.
Details
now --public
Deploys your project and marks it as public. The --public flag prevents you from having to confirm that your project will be public.
"Public" means that people will be able to view your source code and logs via deployment_url/_logs. For example, https://muan-testing.now.sh/_logs.
now ln
Aliases your deployment.
Every deployment gets a new random URL like projectname-aicbqophhw.now.sh. This command aliases your latest deployment with the name set in package.json.
⚠️ Old deployments stay around til it's frozen or manually removed (which takes a while to die completely). This means if your app is actively pulling, listening, or actiing on things, it will not stopped immediately on demand – you might get into a situation where multiple versions of your script is running.
Environment variables
Expose your secret environment variables to your app in package.json. The @ before the variable name tells now to look for variable of that name in the secrets.