Method 1 - Run mongo on docker
Pre-requisites: make, node and docker installed
# Install dependencies:
make install
# Run mongo on docker:
make run-mongo
# Run server:
make run
#Server will be running on: http://localhost:4000
- Node.js-based server with Apollo Server.
- A
/graphql
endpoint is serving the apollo-server.
- Schema returns proper response for the following public query:
{
movies {
title
year
rating
actors {
name
birthday
country
directors {
name
birthday
country
}
}
}
}
- Also supports the following mutation:
mutation createUser($username: String, $password: String) {
createUser(username: $username, password: $password) {
token
user {
id
name
}
}
}
- A mutation-based authentication:
mutation login($username: String, $password: String) {
login(username: $username, password: $password) {
token
user {
id
name
}
}
}
- Authenticated users may request additional fields for the query used earlier. New
evzpav_rating
field returns the a random string between 5.0-9.0:
{
movies {
evzpav_rating
title
year
rating
actors {
name
birthday
country
directors {
name
birthday
country
}
}
}
}