Deploying Static Apps

‚ÄčNow comes with built-in support for static deployments. It considers all projects that don't have a Dockerfile, nor a package.json, a static deployment.

Deploying such a static project is still as easy as running a single command:

now

Static deployments running on Now are powered by serve-handler, which you can download, fork, extend, and even operate locally during development by importing the module itself into an existing server or using its command line interface.

What does this mean for your team and your business?

Great user experience with zero lock-in.

In order to change the default behaviour of your static deployment running on Now, you only need to create a now.json file with a static property that holds any of these values.

Here is an example for forcing trailing slashes:

{
  "static": {
    "trailingSlash": true
  }
}

Then, once you run now, we will automatically upload this configuration to Now and adjust the behavior of the deployment accordingly.

Furthermore, when developing locally, serve can be used. If so, the same configuration file will be read and serve will adapt itself.

If you do not overwrite the following configuration properties using a now.jsonfile, they will be enabled by default for Now:

  • renderSingle set to true
  • cleanUrls set to true
  • headers contains a ETag header for every file
  • directoryListing set to true

You can read more about these properties here.

In order to receive the contents of directories, errors, and other meta information as JSON instead of HTML, you can set the following header on your request:

Accept: application/json

Deployments stay around forever if you do not remove them using now remove, like shown on this page.

Static deployments are never put to sleep and are always quickly accessible.