Using NodeJS for Mock Services
There are a few scenarios where you may need a mock service in place until you get your own back-end services integrated. For example, a mock authentication server for round trip authentication.
Prerequisites for running NodeJS
- NodeJS v10+
- NPM 6+
- forever (recommended)
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install -y nodejs
sudo apt-get install build-essential
sudo npm install forever -g
Forever Commands Reference
- forever start: starts a script as a daemon.
- forever stop: stops the daemon script by
Id|Uid|Pid|Index|Script
. - forever stopall: stops all running scripts.
- forever restart: restarts the daemon script.
- forever restartall: restarts all running forever scripts.