This is a RESTful API for managing TV series data. The API allows you to perform CRUD operations (Create, Read, Update, Delete) on TV series data stored in a MySQL database. The project is built using Node.js, Express, and MySQL.
- GET all series
- GET a series by ID
- POST a new series
- PUT to update an existing series
- DELETE a series by ID
- Node.js
- Express.js
- MySQL
- CORS
-
Clone the repository:
git clone https://github.com/Adalab/modulo-4-evaluacion-final-bpw-RaquelCosta07.git
-
Install dependencies:
npm install
-
Create a
.env
file in the root of the project and add your database connection credentials:DB_HOST= DB_USER= DB_PASSWORD= DB_NAME=series_db DB_PORT=
-
Start the server:
npm start
-
The server will be running on
http://localhost:4002
.
- URL:
/api/series
- Method:
GET
- Response: List of all TV series
Example Response:
{
"info": {
"count": 3
},
"results": [
{
"id": 1,
"title": "Grey's Anatomy",
"category_id": 1,
"director": "Shonda Rhimes",
"main_actor": "Ellen Pompeo"
},
{
"id": 2,
"title": "The Big Bang Theory",
"category_id": 2,
"director": "Chuck Lorre",
"main_actor": "Jim Parsons"
}
]
}