rodrigopasc / RubySampleAPI

Sample REST API made with Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby Sample API

CircleCI

Boilerplate for a Ruby API.

This is just a concept.

Microservices

Summary

Briefing

Assuming the goal is to build a robust and reliable API that meets the standards of REST, this project is a boilerplate for your project.

The project was made with MySQL for the database, Sidekiq with Redis for running processes in the background and Rspec for running tests.

Architecture

Requirements

  • Ruby >= 2.6.3
  • MySQL >= 8
  • Redis >= 5.0.5

Setup

  • Copy .env.sample, update with your information and rename it to .env.
  • Copy config/database.yml.sample, update with your information and rename it to database.yml.
  • Install the dependencies by running: $ bundle.
  • Setup the database by running: $ rails db:create && rails db:migrate
  • Seed the development database. Run: $ rails db:seed
  • Run rspec tests: $ rails rspec
  • Start the server with $ rails s and make sure Redis is running.

Available Routes

HTTP Method Path Description Params HTTP Responses
POST /auth Authentication sign in. username:string required, password:string required 200, 400, 401
GET /api/products Returns all products. 200, 401
POST /api/products Creates a new product. name:string required, description:string 201, 400, 401
GET /api/products/:id Returns a specific product. 200, 401, 404
PATCH/PUT /api/products/:id Updates a specific product. name:string required, description:string 200, 401, 404, 422
DELETE /api/products/:id Destroys a specific product. 204, 401, 404

Gems

About

Sample REST API made with Ruby


Languages

Language:Ruby 99.4%Language:HTML 0.6%