- Clone Repo.
- CD to/repo
- Update the database configuration in knexfile.js file
- Run the Following Command
npm i -g nodemon
npm i -g knex
npm i
knex migrate:latest
Knex seed:run
npm start
- For Authorization send
tokenin header.
This task is for demonstrating your understanding of HTTP, GraphQL, Node.js and general API practices.
Instructions:
- Implement a Node.js-based server with raw
http, Koa or Express. - Add a
/graphqlendpoint serving the apollo-server or any other GraphQL implementation. - Schema must be able to return proper response for the following public query:
{
movies {
title
year
rating
actors {
name
birthday
country
directors {
name
birthday
country
}
}
}
}- Add support for the following mutation:
mutation createUser($username: String, $password: String) {
createUser(username: $username, password: $password) {
token
user {
id
name
}
}
}- To expand on the number four, add a mutation-based authentication that accepts:
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
scoutbase_ratingfield must return the a random string between 5.0-9.0:
{
movies {
scoutbase_rating
title
year
rating
actors {
name
birthday
country
directors {
name
birthday
country
}
}
}
}-
/graphqlmust be accessible for external clients. -
End.