Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mailsg/book-lib

BookLib API is a backend service used to perform CRUD operation with books. It is built with NodeJS Express and uses MongoDB as the database.
https://github.com/mailsg/book-lib

Last synced: 7 days ago
JSON representation

BookLib API is a backend service used to perform CRUD operation with books. It is built with NodeJS Express and uses MongoDB as the database.

Awesome Lists containing this project

README

        

# 📗 Table of Contents

- [📖 About the Project](#about-project)
- [🛠 Built With](#built-with)
- [Tech Stack](#tech-stack)
- [Key Features](#key-features)
- [💻 Getting Started](#getting-started)
- [Setup](#setup)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Install](#install)
- [Usage](#usage)
- [👥 Author](#author)
- [🤝 Contributing](#contributing)
- [⭐️ Show your support](#support)
- [🙏 Acknowledgements](#acknowledgements)
- [📝 License](#license)

# BookLib API

**BookLib API** is a backend service used to perform CRUD operation with books. It is built with NodeJS and uses MongoDB as the database.

## 🛠 Built With

### Tech Stack

Server

Database

### Key Features

- **API Endpoints to perform CRUD operations**
- **Database deployment on Mongo Atlas**

(back to top)

## 💻 Getting Started

To get a local copy up and running, follow these steps.

### Prerequisites

You must have `NodeJS` installed in the local machine and a `MongoDB/Atlas` account created with a `mongodb+srv` connection string. Create a `https://www.postman.com/` account to test the API EndPoints.

### Setup

Clone this repository to your desired folder:

```sh
git clone https://github.com/mailsg/booklib.git
cd booklib
```

### Install

Install this project by executing the following commands. Since its an Open API, there is no need to set up any API keys:

```sh
cd booklib

npm install

touch .env
`Add the following lines to the .env file`
MONGODB_URI=`Your MongoDB-Atlas URI (mongodb+srv)`
PORT=`Your desired port number, where you wish the server to run (default port = 3000)`

- Please note that the above `MONGODB_URI` variable is mandatory for the project to connect to your MongoDB database.

```

### Usage

- To run the project, execute the following command:

```sh
npm start
```

Below are the Endpoints to perform CRUD operations:

`Please note: The default port mentioned is 3000, ensure that appropriate port number is used in the URL, on which server is running`
- **GET** `http://localhost:3000/books` - Get all books
- **GET** `http://localhost:3000/books/:id` - Get a book by id
- **POST** `http://localhost:3000/books` - Create a new book
- **Request Body**
```json
{
"title": "Book Title",
"author": "Book Author",
"publication_year": "Publication Year"
}
```
- **PUT** `http://localhost:3000/books/:id` - Update a book by id
- **Request Body** (Any or all of the following)
```json
{
"title": "Book Title",
"author": "Book Author",
"publication_year": "Publication Year"
}
```
- **DELETE** `http://localhost:3000/books/:id` - Delete a book by id

- To test the project, execute the following command:

```sh
npm test
```

👤 **Sandeep Ghosh**

- GitHub: [@mailsg](https://github.com/mailsg)
- LinkedIn: [LinkedIn](https://linkedin.com/in/sandeep0912)

(back to top)

## 🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the [issues page](../../issues/).

(back to top)

## ⭐️ Show your support

If you like this project consider leaving a star to the repository.

(back to top)

## 🙏 Acknowledgments

Thank you for giving me the opportunity to showcase my skills.

(back to top)

## 📝 License

This project is [MIT](./MIT.md) licensed.

(back to top)