{"id":22725610,"url":"https://github.com/ericafenyo/graphql-presentation","last_synced_at":"2025-03-29T23:42:48.967Z","repository":{"id":124357825,"uuid":"390273092","full_name":"ericafenyo/graphql-presentation","owner":"ericafenyo","description":"A quick look at the GraphQL technology with an example project","archived":false,"fork":false,"pushed_at":"2021-07-30T11:29:13.000Z","size":117,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-05T01:31:20.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericafenyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-28T08:25:27.000Z","updated_at":"2021-07-30T11:29:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"94477412-41c7-455c-9d20-e83c0f39ad43","html_url":"https://github.com/ericafenyo/graphql-presentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericafenyo%2Fgraphql-presentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericafenyo%2Fgraphql-presentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericafenyo%2Fgraphql-presentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericafenyo%2Fgraphql-presentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericafenyo","download_url":"https://codeload.github.com/ericafenyo/graphql-presentation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246258862,"owners_count":20748573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T16:13:05.082Z","updated_at":"2025-03-29T23:42:48.960Z","avatar_url":"https://github.com/ericafenyo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Présentation de GraphQL\nUn bref aperçu de la technologie GraphQL (30 juil 14h  - TransWay)\n\n## Checklist\n- [ ] Introduction\n- [ ] Configurer le serveur\n\u003e Queries\n- [ ] Récupérer tous les utilisateurs\n- [ ] Récupérer un.e seul.e utilisateur/rice\n\u003e Mutations\n- [ ] Ajouter un utilisateur\n- [ ] mettre à jour un.e utilisateur/rice\n- [ ] Supprimer a un.e utilisateur/rice\n- [ ] Supprimer tout\n\n## Introduction\n**GraphQL** (pour **Graph** **Q**uery **L**anguage), une alternative aux [API REST](https://fr.wikipedia.org/wiki/Representational_state_transfer)(**Re**presentational **S**tate**T**ransfer) est une [langage de requêtes](https://fr.wikipedia.org/wiki/Langage_de_requête), créé par Facebook en 2012, avant d'être publié comme projet [open-source](https://fr.wikipedia.org/wiki/Open_source) en 2015.\n\u003e ref: https://fr.wikipedia.org/wiki/GraphQL\n\n## Le langage de requête\n\n### Quelques types de données(Data types)\n\n```graphql\n# Enums\nenum Gender {\n  MALE\n  FEMALE\n  UNSPECIFIED\n}\n\n# Object types\ntype Address {\n  id: ID!  # GraphQL ID type\n  userId: ID!\n  streetName: String!\n  postalCode: Int\n  city: String!\n  country: String!\n}\n\n# Object types (complexe)\ntype User {\n  id: ID!\n  name: String!\n  age: Int!\n  gender: Gender! # enums\n  email: String!\n  weight: Float  # nullable\n  address: Address # Object type\n}\n\n# interface\ninterface Organism {\n  id: ID!\n  name: String!\n  kingdom: Kingdom! # enums\n  genus: String!\n  species: String!\n}\n\ntype BlueGreenAlgae implements Organism {\n phylum: String!\n}\n\n```\n\n## Queries and Mutations(Resolver)\n\n\u003cimg width=\"1081\" alt=\"Screenshot 2021-07-30 at 11 43 42\" src=\"https://user-images.githubusercontent.com/32494423/127635471-b0ba1471-3c1e-4495-97e0-cb6ad05c2be5.png\"\u003e\n\n\u003cimg width=\"1530\" alt=\"Screenshot 2021-07-30 at 11 46 32\" src=\"https://user-images.githubusercontent.com/32494423/127635459-9f5672f2-e0f5-47a7-9a59-785175bc7fe4.png\"\u003e\n\n\n## Prérequis\n\n- node/NPM\n- nestjs cli\n\n## Mise en place du projet\nJ'ai décidé d'utiliser le framework [Nestjs](https://docs.nestjs.com) (qui utilise [Express](https://expressjs.com/) sous le capot) pour m'aider à accélérer la configuration du serveur.\n\n1. Générer les fichiers du serveur avec le CLI Nest:\n\nDepuis votre répertoire de développement préféré, exécutez ces commandes:\n\n```bash\n$ nest new graphql-nest-example\n$ cd graphql-nest-example\n```\n\n2. Lancez le serveur\n\n```bash\n$ npm run start:dev\n```\n\n\u003e N:B J'ai eu une erreur en démarrant le serveur.\\\n\u003e https://stackoverflow.com/questions/66809411/webpack-typescript-errors-on-fresh-nestjs-app\n\n3. Ajouter les dépendances de graphql\n```bash\n$ npm i @nestjs/graphql graphql apollo-server-express@2.x.x\n```\n4. Définir l'emplacement du fichier graphQL généré\n```ts\n// app.module.ts\nimport { GraphQLModule } from '@nestjs/graphql';\n...\n$ imports: [\n    GraphQLModule.forRoot({\n      autoSchemaFile: join(process.cwd(), 'src/schema.gql'),\n    }),\n  ],\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericafenyo%2Fgraphql-presentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericafenyo%2Fgraphql-presentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericafenyo%2Fgraphql-presentation/lists"}