Skip to content

MuhDRifai/Bookshelf-API-with-Express.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Bookshelf API

## Project Description

The Bookshelf API is an implementation using Express.js to manage a book library. This API provides basic operations such as adding, fetching, updating, and deleting books from the library collection.

## Project Structure

- `src`: The main project directory.
  - `postman`: Directory containing images and Postman collections.
    - Images illustrating how to import test commands.
    - `Postman Bookshelf API Test Collection and Environment`: Folder containing Postman collection and environment.

- `src/server.js`: The main file containing the implementation of the Express server and API endpoints.

- `package.json`: Project configuration file including dependencies and scripts to run the project.

## How to Use

1. **Install Dependencies**

   ```bash
   npm install
  1. Run the Server

    • Production mode:

      npm start
    • Development mode with nodemon:

      npm run start-dev
  2. Use Postman for Testing

    When building the Bookshelf API, it is essential to test its functionality. Utilize the provided Postman Collection and Environment files.

    • Retrieve both JSON files from the postman -> Postman Bookshelf API Test Collection and Environment folder:

    • In the Postman application, click the Import button in the left panel.

    • Click the Upload Files button to import both extracted JSON files.

    • Afterward, the Bookshelf API Test Collection and Environment will be available in your Postman.

API Endpoints

  • POST /books: Add a new book to the library.
  • GET /books: Retrieve a list of books with search options.
  • GET /books/:bookId: Retrieve book details based on ID.
  • PUT /books/:bookId: Update book information based on ID.
  • DELETE /books/:bookId: Delete a book based on ID.

Book Data Structure

{
  "id": "unique_id",
  "name": "Book Title",
  "year": "Publication Year",
  "author": "Author",
  "summary": "Book Summary",
  "publisher": "Publisher",
  "pageCount": 300,
  "readPage": 150,
  "finished": false,
  "reading": true,
  "insertedAt": "timestamp",
  "updatedAt": "timestamp"
}

Additional Scripts

  • npm test: Run the testing script (not yet implemented).

Development Environment

  • Node.js
  • Express.js
  • Nanoid
  • Nodemon (for development only)

License

This project is licensed under the ISC License - see the LICENSE file for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published