#Express login boilerplate.
Existing code comes from this great boilerplate : https://github.com/vmasto/express-babel
Learned a lot following this course : https://www.udemy.com/the-complete-nodejs-developer-course-2
Feel free to comment, contribute, and open merge requests :)
$ git clone [email protected]:kamiranoff/express-login.git
$ cd express-login
$ npm install
You also need to create a create a env.json
file at the root of the application (use env.exemple.json).
start mongodb
$ mongod
In a new window of the terminal
$ npm start
To run tests
$ npm run test
// or
$ npm run test-watch
The routes available are :
curl -s -D - POST \
http://localhost:3000/api/users/signup \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'email=aphrodite%40test.com&password=aphrodite'
curl -s -D - POST \
http://localhost:3000/api/users/login \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'email=aphrodite%40test.com&password=aphrodite'
curl -X GET \
http://localhost:3000/api/users/me \
-H 'cache-control: no-cache' \
-H 'postman-token: aa4509ed-7372-d85b-9f83-c69f4a475c23' \
-H 'x-auth: <MY_JWT_TOKEN>' \
-d 'email=aphrodite4%40mythology.com&password=aphrodite'
curl -X DELETE \
http://localhost:3000/api/users/me/token \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'postman-token: f8b7f766-a86c-dae0-23c1-51e29fdf6406' \
-H 'x-auth: <MY_JWT_TOKEN>'