Páginas

Mostrando las entradas con la etiqueta GraphQL. Mostrar todas las entradas
Mostrando las entradas con la etiqueta GraphQL. Mostrar todas las entradas

Asp.Net Core + GraphQL + Docker + Github + AzureDevOps + SonarQube

This project was created to learn about GraphQL and to spread the learnings. You can find the related PPT http://bit.ly/NeorisGraphQLPPT

Project source code: https://github.com/vackup/AspNetCoreGraphQL/

The app runs on 2 docker containers, one for the React frontend and one for the Asp.Net Core GraphQL backend
The project is being built using Azure Devops build pipelines (http://devops.azure.com)




Continuous Code Inspection is being done by SonarQube (https://www.sonarqube.org/).
AspNetCoreGraphQL SonarCloud Dashboard https://sonarcloud.io/dashboard?id=vackup_AspNetCoreGraphQL


What's GraphQL?

GraphQL (https://graphql.org/) is a data query language and specification developed internally by Facebook in 2012 before being publicly open sourced in 2015.

It provides an alternative to REST-based architectures with the purpose of increasing developer productivity and minimizing amounts of data transferred.

GraphQL is used in production by hundreds of organizations of all sizes including Facebook, Credit Karma, GitHub, Intuit, PayPal, the New York Times and many more. https://graphql.org/users/

Some post for building GraphQL APIs with ASP.NET Core

Learning GraphQL using NodeJS

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


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:

  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 } } } }
  4. Add support for the following mutation:
    • mutation createUser($username: String, $password: String) { createUser(username: $username, password: $password) { token user { id name } } }
  5. 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 } } }
  6. 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 } } } }
  7. /graphql must be accessible for external clients.
  8. End.