mrako / nodejs-mongodb-api-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API Example using NodeJS and Mongo

Prerequisites

Install prerequisites

brew install node mongo
npm install grunt-cli -g

Setup

npm install

Running

grunt serve

Testing

grunt test

Requests

Signup

curl --data "email=me@mrako.com&password=test" http://localhost:9000/signup

Login

curl --data "email=me@mrako.com&password=test" http://localhost:9000/login

Posts

curl -H "Authorization: Bearer <yourbearertoken>" http://localhost:9000/posts

curl -H "Authorization: Bearer <yourbearertoken>" --data "name='I should print a boat'" http://localhost:9000/posts

Heroku

curl -H "Authorization: Bearer <yourbearertoken>" https://nodejs-mongodb-api-example.herokuapp.com/posts

Deploying to Heroku

heroku config:set JWT_SECRET=verysecretstring AWS_ACCESS_KEY_ID=yourawsaccesskey AWS_SECRET_ACCESS_KEY=yourawssecretkey
git push heroku master

About


Languages

Language:JavaScript 100.0%