Code Monkey home page Code Monkey logo

books-api's Introduction

BookaPI

The Books API project is a web application that allows for interaction with a book database through a RESTful and Html interface. It provides a set of routes that allow users to easily and quickly retrieve books and configure them.

Python PostgreSQL Linux macOS Windows .ENV

Setup

  • Clone repo

    git clone https://gitlab.com/luismendezdev/books-api.git
  • Create and activate virtual environment

    • Linux, MacOS

      virtualenv venv
      source venv/bin/activate
    • Windows Powershell

      virtualenv venv
      venv\Scripts\activate.ps1
  • Install dependencies

    • Windows Powershell

    pip install -r requirements_dev.txt
  • Create a local database using postgresql

  • Create .env file and your values for:

    POSTGRES_HOST=<YOUR_POSTGRES_HOST>
    POSTGRES_DB=<YOUR_POSTGRES_DB>
    POSTGRES_USER=<YOUR_POSTGRES_USER>
    POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD>
    POSTGRES_PORT=<YOUR_POSTGRES_PORT>
    SERVER_PORT=<YOUR_SERVER_PORT>
    • Also export:

      export POSTGRES_USER=<YOUR_POSTGRES_USER>
      export POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD>
      export POSTGRES_DB=<YOUR_POSTGRES_DB>
      export POSTGRES_PORT=<YOUR_POSTGRES_PORT>
      export SERVER_PORT=<YOUR_SERVER_PORT>
  • Run server

    python main.py

Docker way

  • Add env values into .env and export variables

  • Build and start docker

    docker-compose up --build

Usage

  • Api
Description Endpoint
Get list of books /api/books
Get a book /api/books/<book_id>
  • Html
Description Endpoint
Get list of books /books
Get a book /books/<book_id>

The URLs are validated. If you try to go to a non-existent route, (e.g. /api/books/a-books or /books/hello) it will return a 404 error.

books-api's People

Contributors

dluismendezpy avatar

Watchers

 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.