The principle of

Generally we are in the local development, by accessing the local localhost: port number can directly see the page effect, because the local set up the service. A long time ago, this kind of service was built on the back end, such as PHP, Java backend environment, I remember just graduated, Node was not popular, I developed a simple page need Java personnel to help me install a lot of dependencies and environment, development costs can be said to be quite high. Now front-end personnel can completely use Node to build their own local services, and build services on the target server for external use, greatly improving the status of the front-end.

Publish a complete project, you first need to code the git repository, such as making, then install the node on the target machine, NPM, some tools such as pm2, (about pm2 (http://imweb.io/topic/57c8cbb27f226f687b365636), Pm2 is mainly used to start services.

steps

When published, the machine reads the manifest.yml file and executes a series of instructions on the machine:

  • build.sh

NPM install installs a series of dependency packages

NPM Run Build Webpack package

  • deploy.sh

Install NVM and specify the NVM version

NPM run start Starts the service

So our target server has started the service, access domain name plus port number can be accessed