for music, code and the internet of things.
Install Node.js from the repositories
$ sudo apt install nodejs
Install npm, the Node.js package manager
$ sudo apt install npm
Check which version of Node.js you have installed
$ nodejs -v
mkdir project
cd project
npm init
Link the Express package.
npm install express --save
$ vi index.js
const express = require('express') const app = express() const port = 80 app.get('/', (req, res) => doHomepage(res)) app.listen(port, () => console.log('App: Listening on port '+port)) function doHomepage(res) { res.send('Hello World!') }
Use npm to install the latest version of pm2 on your server
$ sudo npm install pm2@latest -g
$ pm2 start index.js
To restart/kill all processes
$ pm2 restart all