Code Monkey home page Code Monkey logo

bookstore-api's Introduction

Bookstore API README

Setup

Prerequisites

- Ruby 2.5.1
- Rails 5.2 and up
- Ember 3.5 (frontend)(https://github.com/ifellinaholeonce/bookstore-client)
- Master.key
- Ngrok

Getting Started

A. Master Key

Add the master.key file to the config folder

B. Setup DB

bin/rails db:create
bin/rails db:migrate

C. Bundle

bundle

D. Run Server

bin/rails s -b 0.0.0.0

Github Integration

A. Fire up Ngrok

./ngrok http 3000

B. Obtain Ngrok Tunnel Address

Browse to Ngrok's provided web interface, ie. http://127.0.0.1:4040
Copy the http address to clipboard

C. Set ENV variable in terminal Note: This url must contain the http:// prefix

export WEBHOOK_URL=ngrok's http address

D. Setup Github Webhook

bin/rails github_api:create_webhook

Result: "Issues webhook created for bookstore-api pointed to your_WEBHOOK_URL/github"

Seed DB

Note: Ensure Rails server is running with bin/rails s -b 0.0.0.0 and your ngrok tunnel is open first

bin/rails github_api:create_issues

On your server console you will see a number of post requests come in from the github webhook. This will seed the database with authors and books.

Github Integration

Note: Rails server must be running and Ngrok must be open using the setup URL

Navigate to the repo: https://github.com/ifellinaholeonce/bookstore-api

Open Issue

This will send a post request using the webook. The server will create a new author with a name matching the Issue title and a biography matching the Issue description. A book with a random title will also be created, belonging to the new author.

Edit Issue

This will send a post request using the webhook. The server will update the author's biography to match the new description. Note: Updating the Issue title is not supported, yet.

Delete Issue

This will send a post request using the webhook. The server will delete the author and all book's belonging to the author.

Note: Delete Issue is in Beta on Github. The delete button can be found on the bottom right under notifications alt text

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.