This repository contains the backend for BrewApps, a sample application demonstrating CRUD (Create, Read, Update, Delete) operations for managing books. The backend is built using Node.js and various packages such as Express, Mongoose, and others.
- Add a new book with title, author, and summary.
- View a list of all books.
- View details of a specific book by its ID.
- Update a book's details.
- Delete a book.
- Express.js: A web application framework for Node.js.
- Mongoose: A MongoDB object modeling tool.
- Cors: Middleware for handling Cross-Origin Resource Sharing (CORS) to enable API access from different origins.
- Dotenv: For managing environment variables.
- Express-Validator: A set of Express.js middlewares for request data validation.
- JSON Web Token (jsonwebtoken): Used for user authentication and authorization.
- Clone this repository:
https://github.com/ITMsJarvis/BrewApps.git
- Install Dependencies
cd brewapps-backend
npm install
3.Configure environment variables: Create a .env file in the root directory and specify the necessary variables, such as your MongoDB connection string and JWT secret:
PORT=3000
SECRET_CODE="BrewApps",
MONGO_STRING="mongodb+srv://<username>:<password>@cluster0.ss2gsgw.mongodb.net/?retryWrites=true&w=majority"
4.Run the server:
npm start
-
Create User (
POST /create-user
): Add a new user to the system. -
Login (
POST /login
): Authenticate and retrieve a list of all books available in the library. -
Create Books (
POST /create-books
): Add a new book to the library. -
Show Books (
GET /show-books
): View a list of all books in the library. -
View Book Details (
GET /book/:id
): Get detailed information about a specific book by its ID. -
Update Book (
PUT /update-book/:id
): Modify the details of a book, such as its title, author, or summary. -
Delete Book (
DELETE /delete-book/:id
): Remove a book from the library permanently.
-via POSTMAN
https://api.postman.com/collections/29487838-017841b3-4b77-487f-b859-38184053fef2?access_key=PMAT-01HE3MVFE0MWVBC5JMZ34XKHN5
If you would like to contribute to this project, feel free to open issues and pull requests. Your contributions are highly appreciated.
If you have any questions or need further assistance, you can reach out to