[Now] Deploy a Node project with Zeit ' s now

Source: Internet
Author: User

Use Zeit's to now deploy a node application from your local machine to a remote cloud service in moments.

Install:

NPM I-g Now

Deploy:

Now

The URL it generates contains, the first part of the application name, and the second part are generated according To your application current state (code) and Package.json. If you deploy this package against this code, using now, that's the URL that's you get. I can show you so that's true by running ZEIT now again.

If I Run now again, we ' re not going-see it does NPM install and NPM run Build and NPM start, it's actually just going to Give us the same URL again. This is the using a certain property of immutable data structures.

It's actually saying that this deployed instance was like a pure function of this particular named project with the current State of the This Code. No matter how many times I deploy the current state, it's always going to return the same deployment instance that I can g The ET to via URL.

If code changed, when we deploy again, it'll genrate a new URL, but the old one is still available!.

Now offers a nice little escape hatch here. If we define a script called Start, and a script called now start, then when we have run it on now, it ' ll ignore start and I T ' ll run now start. The same for build, if we define a now build, Echo now build step went here.

  "Scripts": {    "Start":"node Index.js",//run this in local    "Now-start":"node Index.js",//in server, would run this instead of "Start"    "Build":"Echo ' BUILD STEP GOES here '",//run in local    "Now-build":"Echo ' now BUILD STEP WENT here! '",//Run in server    "Test":"echo \ "Error:no test specified\" && exit 1"  },

If you want your dev-to-run with certain environment variables, for instance, and your prod to run with other ones or some Thing like this, we can dig a little bit more deeper to that in the future lessons. There is an escape hatch, and there is a-a-a-to-have-now-specific start in build scripts.

[Now] Deploy a Node project with Zeit ' s now

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.