Boilerplate Rails 5 API only Application with JWT authentication with revocation strategy and Devise.
This is fresh start for an Rails 5 API that includes testing framework setup with Rspec, Factory Girl, DB Cleaner.
It uses the devise-jwt which implements JWT (Json Web Token) revocation discussed here
-
Configure Database
Out of the box it uses PostgreSql DB. For this reason you need to have PostgreSql installed and permissions for create DB
-
run
bundle install
-
Run migrations
rails db:migrate
-
Run
rails server
You can see sample Postman requests under directory sample_requests
POST /api/v1/users HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 3b86f9c1-3c60-3612-7de6-2e19eb6ac5ed
{
"user": {
"email": "[email protected]",
"password": "anewpassword",
"password_confirmation": "anewpassword"
}
}
POST /api/v1/users/sign_in HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: d9f5fd9d-83e8-97bf-d8c2-abd8f340963c
{
"user": {
"email": "[email protected]",
"password": "anewpassword"
}
}
It is possible to generate factories using rails g factory_girl:model BlahBla