Welcome to the backend application for Triluxo! This Express.js application interacts with a MongoDB database to manage books.
- Node.js installed
- MongoDB installed and running
-
Clone the repository:
git clone https://github.com/your-username/Triluxo-Backend.git
-
Navigate to the project directory:
cd Triluxo-Backend
-
Install dependencies:
npm install
To access the home page, navigate to https://lovely-moccasins-eel.cyclic.app/ in your browser.
- Retrieve a list of books:
Example response:
GET /books
[ { "id": 1, "title": "Sample Book 1", "author": "Author 1", "publishedYear": 2022 }, { "id": 2, "title": "Sample Book 2", "author": "Author 2", "publishedYear": 2023 } ]
- Add a new book to the database:
Example request body:
POST /post
{ "title": "New Book", "author": "New Author", "publishedYear": 2023 }
- Update an existing book by ID:
Example request body:
PUT /update/:id
{ "title": "Updated Title", "author": "Updated Author", "publishedYear": 2023 }
-
Delete a book by ID:
DELETE /delete/:id
Example response:
{ "message": "Book with ID 1 deleted successfully." }
Make sure to run the application locally (http://localhost:4000) to test these endpoints.