Git Product home page Git Product logo

rsschool-nodejs-task-graphql's Introduction

Assignment: Graphql

Tasks:

  1. Add logic to the graphql endpoint: ./src/routes/graphql.
    Constraints and logic for gql queries should be done based on restful implementation.
    1.1. npm run test-queries
    1.2. npm run test-mutations
  2. Limit the complexity of the graphql queries by their depth with graphql-depth-limit package.
    Use value "5" for package.
    2.1. npm run test-rule
  3. Solve n+1 graphql problem with dataloader.
    You can use only one "findMany" call per loader to consider this task completed.
    3.1. npm run test-loader
    3.2. npm run test-loader-prime
    When you query all users, you don't have to use the database again when you want to find subs.
    Pre-place users in the appropriate dataloader cache.
    To determine if a user is a sub you need to do the appropriate join (include).
    But only do a join when you need it. You can use graphql-parse-resolve-info package to parse GraphQLResolveInfo to determine if subs are expected in the response.

Info:

It is forbidden to add new npm dependencies.
You should only modify/add the code inside the folder ./src/routes/graphql.
Do not create files with the name "index.ts". This name is reserved for fastify plugins.
You are responsible for using style configs that are in the repository.
Make sure the important files have not been changed: npm run test-integrity.
If the test was partially completed, then it is considered not completed.
If the one test was not completed, then the subsequent ones are considered not completed.
You are free to use schema-first or stick to the default code-first.

Steps to get started:

  1. Install dependencies: npm ci
  2. Create .env file (based on .env.example): ./.env
  3. Create db file: ./prisma/database.db
  4. Apply pending migrations: npx prisma migrate deploy
  5. Seed db: npx prisma db seed
  6. Start server: npm run start

Useful things:

  • Database GUI: npx prisma studio
  • Tests modify the db, so if it seems to you that the db has become too large, you can clear it: npx prisma migrate reset (also triggers seeding)
  • Swagger: /docs

rsschool-nodejs-task-graphql's People

Contributors

maks-rafalko avatar nosbog avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.