A music library API created following a CRUD REST API technology using Node.js, Express, Mocha-Chai, Postman and pgAdmin.
- Database design and migration
- PostgreSQL
- Building databases in a Docker container
- Creating API using CRUD (Create, Read, Update and Delete) operations on databases
- Using Postman to manage API requests
- Integration testing using Mocha, Chai and SuperTest
- Use of Dotenv to store sensitive information
- Use of Nodemon to automatically restart the node application when code changes
- Github Actions for automated testing
Fork and clone the repo, and run the following commands. Use Postman and pgAdmin to check if the CRUD operations are working.
npm test # to test the codes
npm start # to start the app at http://localhost:3000
API documentation can be accessed at: http://localhost:3000/api-docs/ .
POST
/artists
(add a new artist)
Parameters and body content
Parameters |
Body content |
None |
name [string], genre [string] |
code |
description |
201 |
successful operation |
GET
/artists
(find all artists)
Parameters and body content
None
code |
description |
200 |
successful operation |
GET
/artists/{id}
(find an artist by ID)
Parameters and body content
Parameters |
Body content |
artistId |
None |
code |
description |
200 |
successful operation |
404 |
aritst not found |
PUT
/artists/{id}
(replace an artist with updated record)
Parameters and body content
Parameters |
Body content |
artistId |
name[string], genre[string] |
code |
description |
200 |
successful operation |
404 |
aritst not found |
PATCH
/artists/{id}
(update an aritst's record)
Parameters and body content
Parameters |
Body content |
artistId |
name[string], genre[string] |
code |
description |
200 |
successful operation |
404 |
aritst not found |
DELETE
/artists/{id}
(delete an artist)
Parameters and body content
Parameters |
Body content |
artistId |
None |
code |
description |
200 |
successful operation |
404 |
aritst not found |
POST
/artists/{id}/albums
(add a new album associated to an artist)
Parameters and body content
Parameters |
Body content |
artistId |
name [string], year [integer] |
code |
description |
201 |
successful operation |
GET
/albums
(find all albums)
Parameters and body content
None
code |
description |
200 |
successful operation |
GET
/albums/{id}
(find an album by ID)
Parameters and body content
Parameters |
Body content |
albumId |
None |
code |
description |
200 |
successful operation |
404 |
album not found |
PUT
/albums/{id}
(replace an album with updated record)
Parameters and body content
Parameters |
Body content |
albumId |
name[string], year[integer] |
code |
description |
200 |
successful operation |
404 |
album not found |
PATCH
/albums/{id}
(update an album's record)
Parameters and body content
Parameters |
Body content |
albumId |
name[string], year[integer] |
code |
description |
200 |
successful operation |
404 |
album not found |
DELETE
/albums/{id}
(delete an album)
Parameters and body content
Parameters |
Body content |
albumId |
None |
code |
description |
200 |
successful operation |
404 |
album not found |
Artists
column |
data type |
id |
integer (PK) |
name |
string |
genre |
string |
Albums
column |
data type |
id |
integer (PK) |
name |
string |
year |
integer |
artistId |
integer (FK) |
๐ค HJ Kang