A quick shell script I wrote to init very simple NodeJS/Express server projects as I like them. Simply clone to the directory of your choosing and run ./node-start
. You must have installed mongodb (and have it running) to run this server. To start up the server, simply:
- Set the port to listen on by setting the
PORT
environment variable:
export PORT=9001
- Run the server:
node server.js
- Test that the routes are in working order:
curl localhost:$PORT/hello
The above should return 'hello'
Routes are located in /config/rotues.js
and the MongoDB setup is in /config/db.js