Init #3: Hello, Web Servers
#Local Installation Instructions
- Run command git clone https://github.com/eastnorthwest/Music-App
- Change into the directory "Music-App"
- Run command npm install
- Run these commands in order: "npm run db:create", "npm run db:setup", "npm run db:seed"
- Run command npm start
#Heroku Installation Instructions
- Install Heroku CLI and login to Heroku if necessary https://devcenter.heroku.com/articles/heroku-cli
- Run command git clone https://github.com/eastnorthwest/Music-App
- Change into the directory "Music-App"
- Run command heroku create
- Run command heroku buildpacks:set heroku/nodejs
- Run command heroku addons:create heroku-postgresql
- Run command heroku pg:psql < ./db/schema.sql
- Run command heroku pg:psql < ./db/data.sql
- Run command git push heroku master
#Accessing the API
Get all artists
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist/all
Get an artist by id.
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist/1
Get an artist by name. NAME = name.
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist/name/Santogold
Add new artist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist POST
{
name: "Artist Name",
genre: "Genre",
image: "http://www.theimageurl.com"
}
Edit artist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist PUT
{
id: 1,
name: "Artist Name",
genre: "Genre",
image: "http://www.theimageurl.com"
}
Delete artist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist DELETE
{
id: 1
}
Get all albums
https://lg-filthy-flamingo-music-app.herokuapp.com/api/albums/all
Get an album by id.
https://lg-filthy-flamingo-music-app.herokuapp.com/api/album/1
Add new album
https://lg-filthy-flamingo-music-app.herokuapp.com/api/album POST
{
name: "Album Name",
artist_id: 1,
image: "http://www.theimageurl.com"
}
Edit album
https://lg-filthy-flamingo-music-app.herokuapp.com/api/album PUT
{
id: 1,
name: "Album Name",
image: "http://www.theimageurl.com"
}
Delete album
https://lg-filthy-flamingo-music-app.herokuapp.com/api/artist DELETE
{
id: 1
}
Get all songs
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song/all
Get all songs in an album
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song/album/ALBUMNAME
Get all songs by an artist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/songs/artist/ARTISTNAME
Get an song by id.
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song/1
Add new song
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song POST
{
name: "Song Name",
album_id: 1
}
Edit song
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song PUT
{
id: 1,
name: "Song Name"
}
Delete song
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song DELETE
{
id: 1
}
Get all playlists
https://lg-filthy-flamingo-music-app.herokuapp.com/api/playlist/all
Get all songs in a playlist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/playlist/songs/2
Add a song to a playlist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/playlist/song POST
{
playlist_id: 1,
album_id: 1
}
Get an playlist by id.
https://lg-filthy-flamingo-music-app.herokuapp.com/api/playlist/1
Add new playlist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/playlist POST
{
name: "Playlist Name",
album_id: 1
}
Edit playlist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/playlist PUT
{
id: 1,
name: "Playlist Name"
}
Delete playlist
https://lg-filthy-flamingo-music-app.herokuapp.com/api/song DELETE
{
id: 1
}