Giter Club home page Giter Club logo

music-library's Introduction

Music Library

A music library API created following a CRUD REST API technology using Node.js, Express, Mocha-Chai, Postman and pgAdmin.

Concepts covered

  • 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

Getting started

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/ .

Screenshot of Swagger API doc of Musci Library


API end points

Artist

POST /artists (add a new artist)

Parameters and body content

Parameters Body content
None name [string], genre [string]

Responses

code description
201 successful operation
GET /artists (find all artists)

Parameters and body content

None

Responses

code description
200 successful operation
GET /artists/{id} (find an artist by ID)

Parameters and body content

Parameters Body content
artistId None

Responses

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]

Responses

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]

Responses

code description
200 successful operation
404 aritst not found
DELETE /artists/{id} (delete an artist)

Parameters and body content

Parameters Body content
artistId None

Responses

code description
200 successful operation
404 aritst not found

Album

POST /artists/{id}/albums (add a new album associated to an artist)

Parameters and body content

Parameters Body content
artistId name [string], year [integer]

Responses

code description
201 successful operation
GET /albums (find all albums)

Parameters and body content

None

Responses

code description
200 successful operation
GET /albums/{id} (find an album by ID)

Parameters and body content

Parameters Body content
albumId None

Responses

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]

Responses

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]

Responses

code description
200 successful operation
404 album not found
DELETE /albums/{id} (delete an album)

Parameters and body content

Parameters Body content
albumId None

Responses

code description
200 successful operation
404 album not found

Models

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)

Author

๐Ÿ‘ค HJ Kang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.