/adonis-jwt-boilerplate

Adonisjs API JWT Boilerplate

Primary LanguageJavaScript

adonis-boilerplate-jwt

Boilerplate/Starter Project for building RESTful APIs using Adonis, MySQL, JWT authentication.

Setup

Clone the repo then install dependencies :

npm install

Create .env file :

cp .env.example .env

Migrations

Run the following command to run startup migrations.

adonis migration:run

Start

Run the following command to start the HTTP server (dev mode).

npm run dev

API

Register

POST /api/v1/auth/register
{email: 'youremail@gmail.com', password: 'yourpasswod'}

Sign-In

POST /api/v1/auth/sign-in
{email: 'youremail@gmail.com', password: 'yourpasswod'}

Refresh the token

POST /api/v1/auth/token/refresh
{refresh_token:'REFRESH_TOKEN'}

Get the current user

GET /api/v1/user/me
Authorization : Bearer YOUR_TOKEN

Logout

POST /api/v1/auth/logout
{refresh_token:'REFRESH_TOKEN'}