npm install
node app.js
Then head on over to http://localhost:3000 to see it in action.
GET
http://localhost:3000/status
Returns JSON data.
POST
http://localhost:3000/users/register
Field Name | Value |
---|---|
username |
username of the user |
password |
plaintext password of the user |
Data must be sent in the request body as x-www-form-urlencoded
data.
If successful, returns {"success" : true}
.
If unsuccessful, returns {"success" : false}
.
POST
http://localhost:3000/users/login
Field Name | Value |
---|---|
username |
username of the user |
password |
plaintext password of the user |
Data must be sent in the request body as x-www-form-urlencoded
data.
If successful, returns {"success" : true}
.
If unsuccessful, returns {"success" : false}
.
GET
http://localhost:3000/music/< song-id >
song-id
- ID of the requested song.
Returns a MP3 file if it exists, else a JSON.
GET
http://localhost:3000/music/details/< song-id >
song-id
- ID of the requested song.
Returns data in JSON format.
GET
http://localhost:3000/image/< song-id >
song-id
- ID of the requested song.
Returns a JPG file if it exists, else a JSON.
POST
http://localhost:3000/favorites/add
Field Name | Value |
---|---|
username |
username of the user |
password |
plaintext password of the user |
musicID |
ID of the song to be added as favorite |
GET
http://localhost:3000/favorites/< username >
username
- Username of the user.
Returns details of all songs favorited by the user, if the user exists. If no song has been favorited yet, returns an empty list. If user does not exist, returns 404 error.
GET
http://localhost:3000/search?query=< query >
Returns details of all songs with artist names closely matching the search query.
GET
http://localhost:3000/random
Returns details of 5 random songs.