Backend Docker for a Node.js REST API with Express and MySQL.
102
PORT=3000
CONNECTION_STRING=mysql://root:1998@db-api-nba:3306/nba_api_node_database
Teams
GET /teams: Retrieves all teams.
GET /teams/:id: Retrieves a specific team by ID.
GET /teams/search: Retrieves filtered teams based on search parameters.
POST /teams: Creates a new team.
PUT /teams/:id: Updates an existing team by ID.
DELETE /teams/:id: Deletes a team by ID.
Statistics
GET /stats: Retrieves all statistics.
GET /stats/:id: Retrieves specific statistics by team ID.
GET /stats/search: Retrieves filtered statistics based on search parameters.
PUT /stats/:id: Updates existing statistics by team ID.
Teams Table
Example JSON for adding and updating teams.
json
{
"team":"CHICAGO BULLS",
"conference":"Leste",
"wins":"37",
"losses":"42",
"value":"2.35",
"coach":"Billy Donovan",
"team_age":"26.4",
"team_height":"200.70",
"team_wingspan":"207.30"
}
Statistics Table
| VERB | URL |
|---|---|
| GET | http://localhost:3000/stats/?limit=6&page=1 |
| GET | http://localhost:3000/stats/1 |
| PUT | http://localhost:3000/stats/35 |
Example JSON for updating statistics of a team.
json
{
"team_age": "22",
"team_height": "80.43",
"team_wingspan": "210.10"
}
$ docker network create net-api
$ docker run --network net-api -dp 127.0.0.1:3000:3000 cintrab98/api-nba:1.2
Content type
Image
Digest
sha256:25545a817…
Size
385.7 MB
Last updated
over 2 years ago
docker pull cintrab98/api-nba:1.2