Code Monkey home page Code Monkey logo

nest-graphql-mongodb's Introduction

NestJs - GraphQl - Mongoose

Module

Divise votre code en élément plus petit et facile à gérer

Resolver

Responsable des réquêtes entrante, comme des controller pour du REST

Service

Contient la logique métier pour les renvoyer au controller ou resolver

Schema

Modéle qui corrépond à un collection

Installation

npm i -g @nestjs/cli

Creation du projet

nest new nest-mongo-graphql

GraphQl et Mongoose

npm i @nestjs/graphql graphql-tools graphql apollo-server-express
npm i --save @nestjs/mongoose mongoose

Creer Module / Service / Resolver

Dans la documentation le premier module crée est cat on fait la même la chose

nest g mo cat
# --no-spec sans les fichiers de test
nest generate service cat --no-spec
nest generate resolver cat --no-spec

GraphQL

cats {
  breed {
    characteristics {
      lifespan
      size
      coat
      color
    }
  }
}
mutation {
  createCat(input: {
    breed: "Thirst cat"
    characteristics: {
      lifespan: "12 as 14 years"
      size: "medium"
      coat: "medium"
      color: "color"
    }
  }) {
    breed {
      characteristics {
        lifespan
        size
        coat
        color
      }
    }
  }
}

nest-graphql-mongodb's People

Stargazers

Roman avatar

Watchers

James Cloos avatar kevingrondin 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.