Git Product home page Git Product logo

books-api-article-part1's Introduction

BOOKS API

In this project, we're set up a simple Rails API-only-application. Rails API-only-applications are slimmed down compared to traditional Rails web applications.

Article

Test Driven Development of a RESTful JSON API With Rails

Built With

  • Ruby v2.7.2
  • Ruby on Rails v6.0.3.2
  • RSpec-Rails for testing

Current API Endpoints

The API will expose the following RESTful endpoints.

BaseUrl: {Host-URL}/api/v1

Endpoint Functionality
POST /register Signup
POST /login Login
GET /books Get all books
GET /books/:id Get a bppl
POST /books Add a new book
DELETE /books/:id Delete a book
PUT /books/:id Update a book
POST /categories Add category
GET /categories Get categories

To get a local copy up and running follow these simple example steps.

Prerequisites

Ruby: 2.6.5 Rails: 6.0.3.2 Postgres: >=9.5

Setup

$ git clone https://github.com/acushlakoncept/books-api-article-part1.git
$ cd books-api-article-part1

Install gems with:

bundle install

Setup database with:

make sure you have postgress sql installed and running on your system

   rails db:create
   rails db:migrate
   rails db:seed

Usage

Start server with:

    rails server

Open http://localhost:3000/ in your browser.

Deploy to a live server

Deploying to a live server like Heroku is easy, make sure you have the necessary credentials setup on your local machine

heroku create
heroku rename app-new-name
git push heroku $BRANCH_NAME:master 

if you are already in master branch no need to add $BRANCH_NAME, just use git push heroku master

heroku run rails db:migrate
heroku run rails db:seed
heroku open

Enjoy your newly deployed rails API

Run tests

    rpsec 

Authors

๐Ÿ‘ค Uduak Essien

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a โญ๏ธ if you like this project!

Acknowledgement

Microverse Inc

books-api-article-part1's People

Contributors

acushlakoncept avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.