Skip to content

bhanwarc/Nodejs-Graphql-Postgres-Task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Back-end task of Code Challenge for Scout base By Bhanwarlal Chaudhary

NodeJs + Knex + GraphQl + Apollo-Server + Postgres

Setup project

  1. Clone Repo.
  2. CD to/repo
  3. Update the database configuration in knexfile.js file
  4. Run the Following Command
npm i -g nodemon
npm i -g knex
npm i 

knex migrate:latest
Knex seed:run

npm start

  1. For Authorization send token in header.

Given Task Was

This task is for demonstrating your understanding of HTTP, GraphQL, Node.js and general API practices.

Instructions:

  1. Implement a Node.js-based server with raw http, Koa or Express.
  2. Add a /graphql endpoint serving the apollo-server or any other GraphQL implementation.
  3. 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
      }
    }
  }
}
  1. Add support for the following mutation:
mutation createUser($username: String, $password: String) {
  createUser(username: $username, password: $password) {
    token
    user {
      id
      name
    }
  }
}
  1. 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
    }
  }
}
  1. Authenticated users may request additional fields for the query used earlier. New scoutbase_rating field 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
      }
    }
  }
}
  1. /graphql must be accessible for external clients.

  2. End.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors