[Tools] Deploy a Monorepo to Now V2

Now by Zeit has recently been updated and now supports multi-language monorepos. In this lesson we'll build and deploy a simple app with an API powered by Node.js and Go.

If you want to follow along with this lesson, you will need to install now-cli.

 

Install:

npm i -g now

 

Create now.json:

{
  "version": 2,
}

 

If we have a index.html, already. We can still run:

now

to deploy the site.

 

Let's say we have current folder structure:

src

  -- index.js

index.html (it includes index.js by inline - script)

We need to include index.js file as well when deploy:

now.json:

{
  "version": 2,
  "builds": [
    { "src": "src/index.js", "use": "@now/node" },
    { "src": "index.html", "use": "@now/static" }
  ]
}

 

If you are using npm modules which installed by yarn or npm, switch to @now/node-server

posted @ 2019-01-02 15:45  Zhentiw  阅读(226)  评论(0编辑  收藏  举报