The backend of the web3 project I participated in before was developed with NodeJS, because the NPM library can be shared, and the Express framework is used. It is the first time to do it. The general deployment process is recorded as follows:
1. Install NodeJS on the server
sudo apt-get install nodejs
2. Install the global NPM tool, node_modules location /usr/local/lib
sudo apt-get install npm
Test whether the installation is successful:
node -v
npm -v
3. Package the back-end Express project to the server, and upload package.json to the server at the same time, which is located in the outer layer of the packaged project. Run in this directory to install dependent packages.
npm i
At this time, the back-end development environment is basically completed and ready to run.
4. The monitoring environment running on the backend of the installation, PM2, PM2 is used for monitoring the node environment, and can easily start and stop management services on the web side. Detailed document PM2 - Quick Start , if you need online monitoring, you need to register an account, after registration, you need to install the pm2-server-monit monitoring package.
npm install pm2 -g
Replace the JS behind the start command with the JS location you actually stored
pm2 start dist/index.js
pm2 link wc706ibbu3pv2if tk7iga1c5d86
pm2 install pm2-server-monit
references: