https://github.com/andre-araujo/express-jwt-authentication-example
A simple jwt authentication with express
https://github.com/andre-araujo/express-jwt-authentication-example
express jwt-authentication jwt-token nodejs passport rest
Last synced: 3 months ago
JSON representation
A simple jwt authentication with express
- Host: GitHub
- URL: https://github.com/andre-araujo/express-jwt-authentication-example
- Owner: andre-araujo
- Created: 2017-11-08T23:27:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-12T14:32:59.000Z (over 7 years ago)
- Last Synced: 2025-01-31T13:43:48.266Z (4 months ago)
- Topics: express, jwt-authentication, jwt-token, nodejs, passport, rest
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Express jwt authentication example
[](https://www.codacy.com/app/andre_luis9214/express-jwt-authentication-example?utm_source=github.com&utm_medium=referral&utm_content=andre-araujo/express-jwt-authentication-example&utm_campaign=badger)
[](http://commitizen.github.io/cz-cli/)A simple jwt authentication with express
## Running the project
* Install all project dependencies with `npm install`
* Start the server with `npm start`
* Or start the server in watch mode with `npm run start:dev`## Connecting to database
### Local database
* Download [mongodb](https://www.mongodb.com/download-center)
* Start it with `mongod`
* If it does not work, check the [instalation guide](https://docs.mongodb.com/manual/administration/install-community/)
* Start the project with `npm start`### Remote database
* Open constants files at `/src/constants/index`
* Change MONGO_URL to your mongo server address
* Start the project with `npm start`## Linting and Conventions
* This project uses eslint with custom [airbnb base config](https://www.npmjs.com/package/eslint-config-airbnb-base) as a lint tool, to start lint run `npm run lint`
* This project uses Commitizen git convention, to commit with right conventions run `npm run commit`
* This project uses a concise timeline, all code pushed to master should be rebased## API
### Create account
POST: `/api/account/singup`Body
```
{
name: String,
email: String,
password: String,
phone: [
{
number: Number,
prefix: Number,
},
],
}
```### Get auth token
POST: `/api/account/token`Body
```
{
email: String,
password: String
}
```### Get user
GET: `/api/account/me`Header
```
Authorization: Bearer
```