This repository contains a Ruby on Rails API template with the following specifications:
Ruby current stable version: 2.7.1
Ruby on Rails current stable version: 6.0.3.3
Authentication: Devise
Testing: Rspec
Database: Postgres
JSON API specification
Create and migrate database:
rails db:create
rails db:migrate
I recommend starting by creating a new resource (in this case called Book) with a POST request to localhost:3000/api/v1/books
with the following parameters:
Headers:
X-User-Email: abc@example.com
X-User-Token: Q2xe5EAHej7CFE-jKMzu
Content-Type: application/vnd.api+json
Body:
{
"data": {
"type":"book",
"attributes":{
"title":"test"
}
}
}
You can retrieve you resources with a GET request to localhost:3000/api/v1/books
with the following headers:
X-User-Email: abc@example.com
X-User-Token: Q2xe5EAHej7CFE-jKMzu