Giter VIP home page Giter VIP logo

book-api's Introduction

Book Collection Project -

Video Link
This GitHub repository hosts a Django project with Django Rest Framework that creates a RESTful API for managing books. It meets the following project requirements:
  ☑ offering operations to list all books,
  ☑ retrieve books by ID,
  ☑ add new books,
  ☑ update existing ones,
  ☑ and delete entries.
Furthermore, it extends functionality to allow:
  ☑ partial updates of book records.
This includes endpoints for specific field updates with thorough validation, ensuring data integrity.
Error responses are provided for invalid input.
This repository serves as a practical demonstration of building a robust RESTful API using Django and Django Rest Framework, showcasing features like partial updates and data validation.

Table of Contents

Prerequisites

Before you begin, ensure you have the following installed:

Getting Started

  1. Clone the repository to your local machine, and navigate into it,
git clone [email protected]:prabhxjottsingh/book-api.git
cd .\book-api\

2.Create a .env file in the project root directory using the following terminal command and enter the virtual enviroment,

virtualenv venv
venv/scripts/activate
  1. Install project dependencies by running,
pip install -r requirements.txt
  1. Activate the database and make the migrations,
python manage.py makemigrations
python manage.py migrate
  1. In the end, don't forget to get out of the virtual environment using the command,
deactivate

Running the application

To start the Bookstore Management System on local system, use the following command:

python manage.py runserver

This will start the server, and you should see a message indicating that the server is running on the specified port.

API endpoints

The system provides the following API endpoints for managing CRUD operation, along with validation:

GET    /books                       : Retrieve all books
GET    /books/{id}                  : Retrieve single book by id
POST   /books/                      : Create a new Book
DELETE /books/{id}                  : DELETE an existing book
PUT    /books/{id}/partial-update/  : Partially update an existing book

Error Hadnling

Creating or updating a book with wrong information will give an error.

Dependencies

The system uses the following main dependencies:

Python: A versatile and high-level programming language.
Django: A Python web framework for building web applications.
Django Rest Framework: A powerful tool for creating RESTful APIs in Django.

Conclusion

You now have the Bookstore Management System up and running on your local machine. Use the provided API endpoints to manage book records in your bookstore. 
Customize and extend the system according to your needs.

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.