Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spm999/book-api
Book Store Api
https://github.com/spm999/book-api
api crud delete get nodejs put rest-api
Last synced: about 6 hours ago
JSON representation
Book Store Api
- Host: GitHub
- URL: https://github.com/spm999/book-api
- Owner: spm999
- Created: 2023-12-29T09:46:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-03T13:56:14.000Z (10 months ago)
- Last Synced: 2024-02-03T14:41:01.538Z (10 months ago)
- Topics: api, crud, delete, get, nodejs, put, rest-api
- Language: JavaScript
- Homepage:
- Size: 656 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Book API
This is a simple RESTful API built using Node.js and Express for managing a collection of books. The API supports basic CRUD (Create, Read, Update, Delete) operations on the book resources.
## Endpoints
### Get all books
- **URL:** `/books`
- **Method:** `GET`
- **Description:** Retrieve a list of all books.
- **Response:** Returns a JSON array of books.### Get a specific book by ID
- **URL:** `/books/:id`
- **Method:** `GET`
- **Description:** Retrieve details of a specific book by providing its ID in the request parameters.
- **Response:** Returns a JSON object representing the book if found, or a 404 status with an error message if not found.### Add a new book
- **URL:** `/books`
- **Method:** `POST`
- **Description:** Add a new book to the collection.
- **Request Body:** Should include a JSON object representing the new book.
- **Response:** Returns the newly added book with a 201 status.### Update a book by ID
- **URL:** `/books/:id`
- **Method:** `PUT`
- **Description:** Update details of a specific book by providing its ID in the request parameters.
- **Request Body:** Should include a JSON object representing the updated book.
- **Response:** Returns the updated book if found, or a 404 status with an error message if not found.### Delete a book by ID
- **URL:** `/books/:id`
- **Method:** `DELETE`
- **Description:** Delete a specific book by providing its ID in the request parameters.
- **Response:** Returns the deleted book if found, or a 404 status with an error message if not found.## Usage
1. Clone this repository.
2. Install dependencies using `npm install`.
3. Start the server with `npm start`.
4. Access the API at `http://localhost:3000/books`.Feel free to use and modify this API for your own projects. For more details on how to interact with the API, refer to the provided endpoints documentation.