Table of Contents

About

ZEIT Now is a cloud platform for serverless deployment.

It enables developers to host websites and web services (without storage) that deploy instantly, scale automatically, and require no supervision, all with minimal configuration.

Data Persistence

Now is a serverless hosting where the workloads are static or stateless. The data is not stored permanently (only transient)

  • Using Cloud APIs that can store metadata on your behalf.
  • Use Cloud Databases that offer secure (preferably HTTPS-based) gateways, for example:

Request handling

When ZEIT Now processes incoming requests at the network edge:

  • It can return a static file directly
  • It can return a cached response
  • It can invoke a lambda that returns a dynamic response

now.json

Only files that are matched by the src property of a Build are “considered for serving”

{
  "version": 2,
  "name": "next-mysql",
  "alias": "next-mysql.now.sh",
  "builds": [
    { "src": "api/**/*.js", "use": "@now/node" },
    { "src": "next.config.js", "use": "@now/next" }
  ],
  "routes": [
    {
      "src": "/api/profiles/(?<id>[^/]*)",
      "dest": "api/profiles/profile.js?id=$id"
    }
  ],
  "env": {
    "MYSQL_HOST": "@mysql_host",
    "MYSQL_USER": "@mysql_user",
    "MYSQL_PASSWORD": "@mysql_password",
    "MYSQL_DATABASE": "@mysql_database"
  }
}

where:

  • version ensures you are using the latest Now 2.0 platform version
  • name defines a project name your deployment will be known by under Now
  • alias allows you to set an alias for a production deployment
  • builds instructs Now to use the @now/node and @now/next builders for your applications API and interface respectively
  • routes routes individual profile requests to the correct function, with the id parameter
  • env injects defined secrets into the app, exposing them as environment variables

Log

now log deploymentURL

now.ignore

whitelist recommanded

*
!index.htm
!api/**

Install / Update

yarn global add now

If bad install with Yarn on Windows, change this file:

@"%~dp0\..\Data\global\node_modules\now\download\dist\now.exe" %*

Windows Location ~\AppData\Local\Yarn\Data\global\node_modules\now\download\dist\now.exe

Support

ECONNREFUSED 127.0.0.1:5000

Error! Failed to complete request to /frontend/_next/webpack-hmr: Error: connect ECONNREFUSED 127.0.0.1:5000
Error! Failed to complete request to /frontend/_next/on-demand-entries-ping?page=/: Error: connect ECONNREFUSED 127.0.0.1:5000

Be sure to open your firewall for the now application. With Network - TCPview

Now Port 5000

Documentation / Reference