https://github.com/konradmi/auth-nodejs-mysql
Boilerplate for server side authentication with node.js, passport and MySQL
https://github.com/konradmi/auth-nodejs-mysql
authentication express jwt mysql nodejs passportjs
Last synced: 3 months ago
JSON representation
Boilerplate for server side authentication with node.js, passport and MySQL
- Host: GitHub
- URL: https://github.com/konradmi/auth-nodejs-mysql
- Owner: konradmi
- Created: 2017-06-26T20:06:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-27T20:07:55.000Z (almost 9 years ago)
- Last Synced: 2025-01-08T19:40:41.603Z (over 1 year ago)
- Topics: authentication, express, jwt, mysql, nodejs, passportjs
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# auth-nodejs-mysql README
## Setup
### Database
To save your time and frustration I've prepared a vagrantfile with a test database
To run the database locally:
Install `mysql`
Install `virtualbox`
Install `vagrant`
Install `vagrant-triggers`
Run `vagrant up`
A brand new instance of MySQL should be listening on port 3310
### Api
Install `nvm`
Install node: `nvm install 6`
Install dependencies: `npm install`
Start api: `npm run start:dev`
Api listens on port 4000 by default, hit http://localhost:4000/health to see if it's live and kicking
## API Endpoints:
`POST /signup` - it accepts login and password. Once it's been verified that there's no user with the given login in the database, the login and hashed password is saved in the database and a JWT token is created and sent back to the user
`POST /singin` - it accepts login and password. It checks if the login and password are ok and a JWT token is sent back to the user
`GET /` - in order to access the route you have to include the JWT token in the `authorization` header in the request.