GithubHelp home page GithubHelp logo

topup_mama_backend_rest's Introduction

TOPUP MAMA LUMEN REST API

The REST API is used for listing the names of books along with their authors and comment count, adding and listing anonymous comments for a book, and getting the character list for a book.

The movie data is fetched online from https://anapioficeandfire.com/ using the laravel Http-client API. The http-client is wrapped around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications

Dependencies

  • Composer
  • PHP 7.2^
  • Database(Postgresql/Mysql/Mariadb)
  • Terminal or Command Line Access

Deployment

  1. Clone the git directory https://github.com/songokjesse/topup_mama_backend_rest.git
  2. Change the directory
  3. Install project dependencies using [composer install] on the terminal
  4. Create an environment variable file [.env] and add the database connection parameters
  5. Run database migrations using [php artisan migrate] on the terminal
  6. Run tests [ vendor/bin/phpunit tests ] on the terminal

API Endpoints

FRONTEND VERCEL(nextjs) URL = https://topup-mama-frontend.vercel.app/

BACKEND HEROKU URL = https://topupmama-backend.herokuapp.com/

Books Endpoint

GET /api/v1/books
GET /api/v1/books?name={name}
GET /api/v1/books?fromReleaseDate={fromReleaseDate}&toReleaseDate={toReleaseDate}
GET /api/vi/book/{id}/comments

Book Responses

GET /api/v1/books
    response: Returns a collection of Books
    {
        "name": "A Game of Thrones",
        "authors": [
        "George R. R. Martin"
        ],
        "comments_count": 1
    }
GET /api/v1/books?name={name}
response: Returns a book specified by name {A Game of Thrones} 
    {
        "name": "A Game of Thrones",
        "authors": [
        "George R. R. Martin"
        ],
        "comments_count": 1
    }
GET /api/v1/books?fromReleaseDate={fromReleaseDate}&toReleaseDate={toReleaseDate}
response: Returns book filtered by date
    {
        "name": "A Game of Thrones",
        "authors": [
        "George R. R. Martin"
        ],
        "comments_count": 1
    }
GET /api/vi/book/{id}/comments
response: Returns a collection of book comments ordered in a descending order
{
	"book_id": "1",
	"comment": "ghfhgfhgfhgfh\\",
	"ip_address": "127.0.0.1",
	"created_at": "2022-03-22 14:41:43"
},

Characters

Characters Endpoint

GET /api/v1/characters
GET /api/v1/characters?gender={gender}
GET /api/v1/characters?sort_by={value}&order={order}

Characters Responses

GET /api/v1/characters
response: Returns a collection of characters and character count 
{
    "character_data": [
    {
    "url": "https://www.anapioficeandfire.com/api/characters/1",
    "name": "",
    "gender": "Female",
    "culture": "Braavosi",
    "born": "",
    "died": "",
    "titles": [
    ],
    "character_totals": 10
    }
GET /api/v1/characters?gender={gender}
response: Returns a collection of characters filtered by gender(male or female) and character count 
{
    "character_data": [
    {
    "url": "https://www.anapioficeandfire.com/api/characters/1",
    "name": "",
    "gender": "Female",
    "culture": "Braavosi",
    "born": "",
    "died": "",
    "titles": [
    ],
    "character_totals": 10
    }
GET /api/v1/characters?sort_by={value}&order={order}
response: Returns a collection of characters sorted by {name,gender or age} and character count 
{
    "character_data": [
    {
    "url": "https://www.anapioficeandfire.com/api/characters/1",
    "name": "",
    "gender": "Female",
    "culture": "Braavosi",
    "born": "",
    "died": "",
    "titles": [
    ],
    "character_totals": 10
    }

Comments

Comment Endpoints

GET /api/v1/comments
GET /api/v1/comment/{id}
POST /api/v1/comments

Comments Responses

GET /api/v1/comments
response: Returns a list of comments sorted in decsending order
{
"book_id": "1",
"comment": "Test Comment",
"ip_address": "127.0.0.1",
"created_at": "2022-03-28 10:44:27"
}
GET /api/v1/comment/{id}
response: Returns a comment using {id}
{
"book_id": "1",
"comment": "Test Comment",
"ip_address": "127.0.0.1",
"created_at": "2022-03-28 10:44:27"
}
POST /api/v1/comments
response: Returns comment stored into the database
{
"book_id": "1",
"comment": "Test Comment",
"ip_address": "127.0.0.1",
"created_at": "2022-03-28 10:44:27"
}

Official Documentation

Documentation for the framework can be found on the Lumen website.

topup_mama_backend_rest's People

Contributors

songokjesse avatar

Watchers

James Cloos avatar  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.