Skip to content

bengala-tech/rails-api

Repository files navigation

Rails API

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

Getting started

Create and migrate database:

rails db:create
rails db:migrate

Usage

Creating a Resource

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"
    }
  }
}

Getting a Resource

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published