Back-end REST API for www.codever.dev based on Node.js with ExspressJS
This section concerns about the local developemnt
It might happen to have a zombie running nodejs running on the port 3000
when trying to run npm run debug
.
Kill the process and try again
lsof -i tcp:3000
kill -9 xxx # where xxx is the process number from the command above
npm run debug # restart the backend server as usual
Run the test
npm task
npm run test
To run the integration you have to prepare and start the local docker image and node for backend as specified in the main README file.
When ready run the following command
npm run test:integration
The API has an OpenAPI specification available at docs/openapi/openapi.yaml
Based on that a GUI is generated to test the API directly from browser:
We currently use pm2 to start the project in production
Undo local changes if needed:
git fetch
git reset --hard origin/master
## status
pm2 status
## start
pm2 start pm2-process-cluster.json
## restart - kills and restarts the process
pm2 restart pm2-process-cluster.json
## reload - in comparison with "restart", "reload" achieves 0-second-downtime reload
pm2 reload pm2-process-cluster.json
## stop
pm2 stop pm2-process-cluster.json
# start
pm2 start pm2-process.json --env production --time
# restart
pm2 restart pm2-process.json --env production --time
# stop
pm2 stop pm2-process.json --env production
Commited is a pm2-process.exammple.json example file
pm2 logs bookmarks.dev-api-node-10.15.0 --lines 1000
tail -f n100 ~/projects/bookmarks.dev-bk/backend/log/access.log
When pm2 start pm2 start pm2-process.json --env production
has the status errored
, it might help to delete the app id
pm2 delete bookmarks.dev-api-node-10.15.0
and then try again