Apollo Server wrapper for Music Story API
- Install Docker
- Install Docker Compose
- Clone the repository and change into it
git clone [email protected]:SrMoffat/wer1-backend.git
cd wer1-backend
- Start the database and the app
docker-compose up --build
- Open app
http://localhost:4000/graphql
You need to install PostgreSQL on your machine and run it:
e.g. on Mac OS:
brew install postgresql
brew services start postgresql
When the postgreSQL database it up and running then:
- Clone the repository and change into it
git clone [email protected]:SrMoffat/wer1-backend.git
cd wer1-backend
- Create environment variables file using template
cat .env.example >> .env
- Create a Music Story Account and set the following environment variables in
.env
:
export MUSIC_STORY_CONSUMER_KEY=
export MUSIC_STORY_CONSUMER_SECRET=
export MUSIC_STORY_ACCESS_TOKEN=
export MUSIC_STORY_ACCESS_TOKEN_SECRET=
export APP_SECRET_KEY=this can be any random string
- Add DB credentials to be used for PostgreSQL
export POSTGRES_USER="postgres"
export POSTGRES_PASSWORD="postgres"
export POSTGRES_DB="dev"
// Add server port
export PORT=4000
- Export environment variables and then start the server
docker-compose up --build
Sign Up User
mutation signupMutation($email: String!, $password: String!, $name: String!) {
signup(email: $email, password: $password, name: $name) {
token
user {
id
name
email
}
}
}
Login User
mutation loginMutation($email: String!, $password: String!) {
login(email: $email, password: $password) {
token
user {
id
name
email
}
}
}
Fetch Tracks
query fetchTracksQuery {
fetchTracks {
externalId
title
type
length
isrc
creationDate
productionDate
}
}
Search Track by Title
query searchTrackQuery($title: String!) {
searchTrackByTitle(title: $title) {
externalId
title
type
length
isrc
creationDate
productionDate
}
}
Search Track by Internal ID
query searchTrackByInternalId($internalId: Int!) {
searchTrackByInternalId(internalId: $internalId) {
externalId
title
type
length
isrc
creationDate
productionDate
}
}
Update Track Details by ID
mutation updateTrackMutation($creationDate: String, $internalId: String, $isrc: String, $productionDate: String, $title: String, $type: String) {
updateTrack(creationDate: $creationDate, internalId: $internalId, isrc: $isrc, productionDate: $productionDate, title: $title, type: $type) {
externalId
title
type
length
isrc
creationDate
productionDate
}
}
Delete Track by ID
mutation deleteTrackMutation($internalId: Int) {
deleteTrack(internalId: $internalId) {
externalId
title
type
length
isrc
creationDate
productionDate
}
}