Development :: Local - matthewsullivan/koa-jwt-mongo-auth GitHub Wiki

Installation

Install dependencies

$ npm install

Database

Install MongoDB

https://docs.mongodb.com/manual/administration/install-community/

Setup

Set environment and build database

$ export NODE_ENV=development && npm run db-init

Serve

$ npm run debug

cURLS

Register

$ curl http://127.0.0.1:3000/api/v1/register/ -d 'email=[EMAIL]&firstName=[FIRST_NAME]&lastName=[LAST_NAME]&password=[PASSWORD]' 

Login

$ curl http://127.0.0.1:3000/api/v1/login/ -d 'email=[EMAIL]&password=[PASSWORD]'

View Profile

$ curl http://127.0.0.1:3000/api/v1/profile/[USER_ID] -H 'Authorization: Bearer [ACCESS_TOKEN]'

Update Profile

$ curl http://127.0.0.1:3000/api/v1/user/profile -d 'email=[EMAIL]&firstName=[FIRST_NAME]&lastName=[LAST_NAME]' -H 'Authorization: Bearer [ACCESS_TOKEN]'

Update Password

$ curl http://127.0.0.1:3000/api/v1/user/password -d 'password=[PASSWORD]' -H 'Authorization: Bearer [ACCESS_TOKEN]'