Giter VIP home page Giter VIP logo

flask-bookstore's Introduction

Bookstore API

Description:

This Flask application provides a RESTful API for managing a bookstore. It allows users to add, retrieve, update, and delete books, as well as register and login.

Endpoints:

Books

  • GET /books - Get all books
  • POST /add_book - Add a new book
  • GET /get_book/ - Get a book by ISBN
  • PUT /update_book/ - Update a book by ISBN
  • DELETE /delete_book/ - Delete a book by ISBN

Users

  • POST /register - Register a new user
  • POST /login - Login a user
  • GET /logout - Logout a user

Usage:

  1. Clone the repository:
git clone https://github.com/mshubham0203/flask-bookstore.git
  1. Install the required Python packages:
pip install -r requirements.txt
  1. Create a .env file in the project directory and add the following environment variables:
MONGO_URI=<mongodb connection string>
SECRET_KEY=<secret key for Flask session>
  1. Run the application:
flask run
  1. Open Postman or another API testing tool and send requests to the API endpoints.

Example:

To add a new book, send a POST request to the /add_book endpoint with the following JSON payload:

{
  "title": "The Hitchhiker's Guide to the Galaxy",
  "author": "Douglas Adams",
  "ISBN": "978034537",
  "price": 1299,
  "quantity": 5
}

You should receive a response like this:

{
  "message": "Book added successfully"
}

To get all books, send a GET request to the /books endpoint. You should receive a response like this:

{
  "books": [
    {
      "book_id": 1,
      "title": "The Hitchhiker's Guide to the Galaxy",
      "author": "Douglas Adams",
      "ISBN": "9780345397",
      "price": 1299,
      "quantity": 5
    }
  ]
}

flask-bookstore's People

Contributors

mshubham0403 avatar

Watchers

 avatar

Forkers

fezaan

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.