-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Matthew Sullivan edited this page Jun 13, 2024
·
5 revisions

Lightweight user registration/login API that returns stateless json web tokens to access secured routes.
Install dependencies
$ npm install
Install MongoDB
https://docs.mongodb.com/manual/administration/install-community/
Set environment and build database
$ export NODE_ENV=development && npm run db-init
$ npm run debug
$ export NODE_ENV=development && npm run db-init && npm run test
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]'
Pull requests are welcome. For major changes, open an issue first to discuss what you would like to change.
Please make sure to update and or write tests as appropriate.