项目作者: jsnomad

项目描述 :
Adonisjs API JWT Boilerplate
高级语言: JavaScript
项目地址: git://github.com/jsnomad/adonis-jwt-boilerplate.git
创建时间: 2018-01-21T11:45:37Z
项目社区:https://github.com/jsnomad/adonis-jwt-boilerplate

开源协议:

下载


adonis-boilerplate-jwt

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

Setup

Clone the repo then install dependencies :

  1. npm install

Create .env file :

  1. cp .env.example .env

Migrations

Run the following command to run startup migrations.

  1. adonis migration:run

Start

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

  1. npm run dev

API

Register

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

Sign-In

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

Refresh the token

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

Get the current user

  1. GET /api/v1/user/me
  2. Authorization : Bearer YOUR_TOKEN

Logout

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