⚡
light
  • light
  • guides
    • getting started
    • server vs serverless
    • routes
    • models
    • factories
    • routing
    • plugins
    • middleware
    • query
    • params
    • global
    • error handling
    • hot module reloading (TODO)
    • databases (TODO)
      • mongoose
      • objection/knex
    • testing (TODO)
      • ava
      • jest
    • deployments (TODO)
      • runkit
      • aws
      • now
      • heroku
      • server
      • google cloud
      • azure
      • netlify
    • misc (TODO)
      • apollo/graphql
  • api
    • server({ routes, opts }): object
    • params(path, url): Promise<object>
    • boom
      • Coming soon
    • micro
      • Coming soon
      • Coming soon
      • Coming soon
      • Coming soon
      • Coming soon
      • Coming soon
Powered by GitBook
On this page
  • Introduction
  • Setup

Was this helpful?

  1. guides
  2. deployments (TODO)

now

PreviousawsNextheroku

Last updated 5 years ago

Was this helpful?

Introduction

Now is a new serverless platform provided by ZEIT. Their aim is to make serverless deployments easy and hassle free. Fortunately light works well with Now to make it even easier!

Note that this guide targets their V2 platform and will not work with their older docker system (see on how to use server mode)

Setup

All data required to host on the now platform is stored in a now.json file.

{
  "version": 2,
  "name": "my-light-project",
  "builds": [{ "src": "routes/**/*.js", "use": "@now/node" }],
  "routes": [
    { "src": "/", "dest": "routes/index.js" },
    { "src": "/(.*)", "dest": "routes/$1.js" }
  ],
  "env": {
    "NODE_ENV": "production",
    "LIGHT_ENV": "now"
  }
}

NOTE: Now uses the file system as the router by default, so custom paths you have set with the path flag will not work by default. You will need to manually add your routes to the now.json. The configuration above will forward / to the routes/index.js handler.

Once you save the file in the root folder, all you need to do is run the now command. If you have not already, see the . See the to customize light and your deployment how you want.

server
guides on how to install now-cli
docs for now