Update config-mongodb.yml
to point to where you want MongoDB to point.
storage:
dbPath: "/path/to/mongo-auth"
Assuming MongoDB is installed locally...
mongod -f config-mongod.yml
Start the API Server:
npm install # if first time.
npm start
Should now be running on localhost:8080
POST: http://localhost:8080/api/register
curl \
-H "Content-Type: application/json" \
-X GET http://localhost:8080/api/login \
-d '{ "email": "[email protected]", "username": "examplename", "password": "123" }'
{
"username": "yourhandle",
"email": "[email protected]",
"password": "123",
"name": {
"first": "John",
"last": "Doe"
}
}
POST: http://localhost:8080/api/login
curl \
-H "Content-Type: application/json" \
-X GET http://localhost:8080/api/login \
-d '{ "email": "[email protected]", "password": "123" }'
{
"code": null,
"message": "OK",
"success": true,
"data": [],
"token": "xxx.yyy.zzz"
}
curl \
-H "Content-Type: application/json" \
-H "Authorization: JWT xxx.yyy.zzz" \
-X GET http://localhost:8080/api/account
"Authorization" : "JWT <token>"
{
...
"token": "JWT <token>"
}
http://localhost:8080/api/account?token=<token>