Array
University of Oregon

Zeit Now

The web has evolved into a platform for application development. Browsers are no longer just document renderers, they are the most ubiquitous application runtimes on the planet.

A “web app” is an application that use the browser as a runtime and HTML, CSS, JavaScript and AJAX.

Zeit Now allows you deploy your JavaScript (Node.js) powered application to the cloud with a single command.

This is an example of Platform-as-a-Service (PaaS).

Any directory that contains a package.json file can be transported to the cloud with one command: now.

Every time you deploy a project, now provides a new URL similar to: my-app-erkgfjtrna.now.sh.

=> Sign In to Zeit Now with your Github account.


Install the Zeit Now CLI with NPM

Zeit recommends a global install with npm.

Test if the install succeeded:

$ now --version
$ now help

List all global packages:
npm list -g --depth=0


Login using the following command:

The login command does not use password authentication– it uses email verification. The login command prompts you for your email address, and sends you an email containing a confirmation button, which you must click to complete the login process.


You can also login with a token, which you first create using your Zeit Now settings dashboard. Store the token in a text file outside of any Git repo, to keep it secure. You then paste your token into the login command, as shown in this example:

 

 

To create a token, sign in to Zeit Now, access your account settings, and select the Tokens tab:

Important: Store the token in a secure text file outside of any repo– you do not want to push it to Github by accident!

The safest place to store the token is  in ~/.now/auth.json

{
  "_": "This is your Now credentials file. DON'T SHARE!",
  "token": "your token goes here"
}

Then you can log in at the command line with one word (“login”), and you will not be prompted for a password.


Deploy a React App to Zeit Now

  1. cd to your react_scrimba directory.
  2. deploy your app with a single command in your terminal (this requires you to be logged in to Now):

 


Creating URL Aliases

The URLs generated by Now are good for development and staging, but not ideal to share with the public.

Now aliases are a way of renaming your deployment. Read Alias Basics to learn how.


Troubleshooting

If you encounter errors installing Zeit Now, read about NPM Global Packages. Another alternative is to install the Now app.

Windows:
If “now –version” works in Gitbash, but “now” generates an error, you can run the now command as follows:

Start the Windows Command Prompt.

In the command prompt window, use the “cd” command to navigate to the directory in which you wish to run now.

(Other useful commands: “dir” == “ls”, “chdir” == “pwd”.)

Run the now command.


Static Websites

Now can also be used to host regular (static) websites, not just Node web apps. This makes it a direct competitor Surge.com and similar hosting services.

Example

  1. cd to ~/Documents/repos/281/examples/ch6/Now/static
  2. Download index.html and app.js to static.
  3. Download clock.png to static.
  4. Deploy the static site with Now.

 


 

Skip to toolbar