This project is a CRUD API built with Node.js and SQLite. It manages Authors and Books, providing endpoints to create, read, update, and delete records. Unit tests are included using Jest.
- Clone the repository:
git clone https://github.com/ErickGBR/tecnical-test-node.git
- Navigate to the project directory:
cd tecnical-test-node
- Install the dependencies:
npm install
- Start the server:
The server will start on
npm run serve
http://localhost:3000
.
- GET /api/v1/db/: Retrieve the route to create database tables
- GET /authors: Get all authors
- GET /authors/:id: Get a single author by ID
- POST /authors: Create a new author
- Request body:
{ "name": "<STRING>", "bio": "<STRING>" }
- Request body:
- PUT /authors/:id: Update an author by ID
- Request body:
{ "name": "<STRING>", "bio": "<STRING>" }
- Request body:
- DELETE /authors/:id: Delete an author by ID
- GET /books: Get all books
- GET /books/:id: Get a single book by ID
- POST /books: Create a new book
- Request body:
{ "title": "<STRING>", "summary": "<STRING>", "authId": <INTEGER> }
- Request body:
- PUT /books/:id: Update a book by ID
- Request body:
{ "title": "<STRING>", "summary": "<STRING>", "authId": <INTEGER> }
- Request body:
- DELETE /books/:id: Delete a book by ID
- Run the tests with Jest:
npm test
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.