chriscoderdr / books-library-api-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Athena API

This is a test application written for GBH.

Athena is an API for a book's library with the following features:

  • Users can list available books
  • Users are able to read each book page in the desired format
  • Books are available in plain text and HTML

Note: in a future we want to add support to more reading formats and be able to connect with other API that provides books.

Requirements

How to setup

  • edit config/database.json to reflect your database settings (by default sqlite ./db.sqlite).
  • edit src/api/config/server.js to reflect your pagination, host port and url settings
  • run yarn install (to install all dependencies)
  • run yarn migrate to run migrations
  • run yarn seed to run all seeds
  • run yarn test to run all unit tests (optional)
  • run yarn start-dev to start the server

API

  • /v1.0/book: returns all the books available
  • /v1.0/book/$book_id?top=$top&skip=$skip: return specific book
  • /v1.0/book/$book_id/page?top=$top&skip=$skip: return pages from specific book
  • /v1.0/book/$book_id/page/$page_id: return specific page given page id and book id
  • /v1.0/book/$book_id/page/$page_id/$format: returns page content in required format (supported formats: [html, text]). Ex: /v1.0/book/1/page/1/html will return page content of page with id 1 in html.

Note: top ad skip are optional parameters.

About


Languages

Language:HTML 99.6%Language:JavaScript 0.4%