Visit https://a-nodejs-api.herokuapp.com
Routes:
/todos
- Create a "free" new DB on https://mlab.com
- Add a database user
- Copy the the URI using the database user credentials
heroku config:set MONGODB_URI="URI"
git push heroku master
- NB: It can take up to 1 minute for the server to charge
- GET https://a-nodejs-api.herokuapp.com/todos
- GET https://a-nodejs-api.herokuapp.com/todos:id
- POST https://a-nodejs-api.herokuapp.com/todos
{
"text": "Test via postman"
}
-> NB: Be sure to select JSON (application/json) when writing the body in Postman
- DELETE https://a-nodejs-api.herokuapp.com/todos:id
- UPDATE https://a-nodejs-api.herokuapp.com/todos:id
{
"text": "New test"
}
- GET https://a-nodejs-api.herokuapp.com/users/me -> passing x-auth/token in headers request found in POST headers response
- POST https://a-nodejs-api.herokuapp.com/users
{
"email": "email@test.com",
"password": "pass123!"
}
- Install MongoDB and create a mongo-data folder next to it
./mongod --dbpath ~/.../mongo-data
in mongo/bin root folder- if port already used:
sudo lsof -i :portNumber
andkill -9 PID
npm run testWatch
to run units testsnpm start
to run server- Use Robomongo to check data