https://github.com/jsnomad/adonis-jwt-boilerplate
Adonisjs API JWT Boilerplate
https://github.com/jsnomad/adonis-jwt-boilerplate
adonisjs api boilerplate jwt rest
Last synced: about 1 year ago
JSON representation
Adonisjs API JWT Boilerplate
- Host: GitHub
- URL: https://github.com/jsnomad/adonis-jwt-boilerplate
- Owner: jsnomad
- Created: 2018-01-21T11:45:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-26T06:09:59.000Z (over 8 years ago)
- Last Synced: 2025-04-01T15:09:58.116Z (over 1 year ago)
- Topics: adonisjs, api, boilerplate, jwt, rest
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 21
- Watchers: 2
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# adonis-boilerplate-jwt
Boilerplate/Starter Project for building RESTful APIs using Adonis, MySQL, JWT authentication.
## Setup
Clone the repo then install dependencies :
```bash
npm install
```
Create .env file :
```bash
cp .env.example .env
```
### Migrations
Run the following command to run startup migrations.
```js
adonis migration:run
```
### Start
Run the following command to start the HTTP server (dev mode).
```bash
npm run dev
```
### API
Register
```bash
POST /api/v1/auth/register
{email: 'youremail@gmail.com', password: 'yourpasswod'}
```
Sign-In
```bash
POST /api/v1/auth/sign-in
{email: 'youremail@gmail.com', password: 'yourpasswod'}
```
Refresh the token
```bash
POST /api/v1/auth/token/refresh
{refresh_token:'REFRESH_TOKEN'}
```
Get the current user
```bash
GET /api/v1/user/me
Authorization : Bearer YOUR_TOKEN
```
Logout
```bash
POST /api/v1/auth/logout
{refresh_token:'REFRESH_TOKEN'}
```