This is an API for managing books and users, built with Node.js and TypeScript. It supports CRUD operations for books and users, includes authentication, file uploads, and integrates with Cloudinary for media storage.
- Manage Books: Add, update, delete, and retrieve book details.
- User Management: Register, authenticate, and manage users.
- File Uploads: Upload files with Cloudinary integration.
- Dockerized: Easy deployment with Docker.
📂 src
┣ 📂 book
┃ ┣ 📜 bookController.ts
┃ ┣ 📜 bookModel.ts
┃ ┣ 📜 bookRouter.ts
┃ ┗ 📜 bookTypes.ts
┣ 📂 user
┃ ┣ 📜 userController.ts
┃ ┣ 📜 userModel.ts
┃ ┣ 📜 userRouter.ts
┃ ┗ 📜 userTypes.ts
┣ 📂 config
┃ ┣ 📜 cloudinary.ts
┃ ┣ 📜 config.ts
┃ ┗ 📜 db.ts
┣ 📂 middlewares
┣ 📜 app.ts
┣ 📜 Dockerfile
┣ 📜 docker-compose.yaml
┗ 📜 ecosystem.config.js
- Node.js: v16 or higher
- Docker: v20 or higher
- Cloudinary Account: To store and retrieve uploaded media files
git clone https://github.com/your-username/elib.git
npm install
-**Create a .env file in the root directory and configure the following variables:
**CLOUDINARY_URL= **DATABASE_URL= **JWT_SECRET= **PORT=3000
To start the development server:
npm run dev
To build and run the application using Docker Compose:
docker-compose up
GET /books- Fetch all booksPOST /books- Add a new bookPUT /books/:id- Update a bookDELETE /books/:id- Delete a book
POST /users/register- Register a new userPOST /users/login- Authenticate a user
POST /upload- Upload files to Cloudinary