Motivation and background
Trying to learn GraphQL (https://graphql.org/) I found the "Code Challenge for Scoutbase" (https://medium.com/scoutbase/we-are-hiring-javascript-developers-e7833762a40d).The drawback of the challenge was that I've never done a nodejs app but as I knew JS and I have many many years of experience building web apps (mainly .net) and I love to learn new thing, I decided to go for it!
So I went from nothing (0) using NodeJs, GraphQL, Sequelize, PostgreSQL to this in just a couple of hours.
Here you have the code (it's an MVP or a prototype) and the code challenge description
https://github.com/vackup/scoutbase-code-challenge-back-end/
The app is deployed to Azure through Azure pipelines.
The app is using an Azure Database for PostgreSQL.
You can access the Graphql playground here https://scoutbase-code-challenge-backend.azurewebsites.net/graphql
Helpful links
- Getting a new node project started with npm · Mark Wolfe's Blog
- Node.js Everywhere with Environment Variables! - Node.js Collection - Medium
- Setup PostgreSQL on Windows with Docker – Eric L. Anderson
- Debugging Node.js applications on Azure App Services Linux/containers | Microsoft Azure Open Source Development Support Team Blog
- How to setup Express.js in Node.js - RWieruch
- GraphQL Server Tutorial with Apollo Server and Express - RWieruch
- GraphQL Context – Patrick Desjardins' Blog
- How to setup a TypeScript, NodeJS, Express Apollo Server to easy debugging with VsCode – Patrick Desjardins' Blog
- Install Apollo Server to host a GraphQL service – Patrick Desjardins' Blog
- Authentication and Authorization in GraphQL (and how GraphQL-Modules can help)
- UpToSkill – Custom Scalars in GraphQL
- Setting up a Node development environment - Aprende sobre desarrollo web | MDN
Back-end task of Code Challenge for Scoutbase
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 /graphql endpoint 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_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 } } } }
- /graphql must be accessible for external clients.
- End.
No hay comentarios.:
Publicar un comentario