Crud with GraphQL + Express + Json Server

Overview

How to run the project

### Install dependecies
$ yarn install

### Run GraphQL server
$ yarn dev

### Run Json Server
$ yarn run json:server

### The server will start at port http://localhost:4000/graphql 
### The Json Server will start at port http://localhost:3000/users/

How the project work?

In my server.js I have my express code that can start my server and listen on localhost:4000/graphql a GraphQL server that listen my schema and a rule that set my property graphiql to true.

schema.js has the GraphQL schema, with my types, Queryes and mutations.

How to run the CRUD?

With the both server started, I made two principles fetches: user and company.

The user fetch:

# Will return informations about user with id "41"

{
  user(id: "41") {
    id
    firstName
    age
    company {
      name
    }
  }
}

The company fetch:

# Will return informations about the company by id and who users work in this company

{
  company(id: "2"){
    id	
    name
    description
    users{
      firstName
    }
  }
}

Add users:

mutation{
  addUser(firstName: "Elon" age: 32){
    firstName
    age
  }
}

Delete users:

mutation{
  deleteUser(id: "4pQ-ym-"){
    id
  }
}

Edit users:

mutation {
  editUser(id: "uX1tabO", firstName: "Markinhos", age: 100, companyId: "2") {
    id
    firstName
    age
    company{
      id
      name
      description
    }
  }
}


You might also like...

simple PWA catalogue with vanilla javascript and json-server as a fake server

simple PWA catalogue with vanilla javascript and json-server as a fake server

simple PWA catalogue with vanilla javascript and json-server as a fake server

Mar 12, 2022

NextJS with GraphQL using type-graphl and graphql-codegen adoptable dogs example code

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Mar 31, 2022

GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages, from standalone APIs to composed schemas (Federation, Stitching)

GraphQL Hive GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages, from standalone APIs to composed schem

Dec 21, 2022

This an CRUD app built were users can create, update and delete specific day to day tasks as they wish. The app is built using webpack and served with webpack dev server

This an CRUD app built were users can create, update and delete specific day to day tasks as they wish. The app is built using webpack and served with webpack dev server

Todo-List This an CRUD app built were users can create, update and delete specific day to day tasks as they wish. The app is built using webpack and s

Sep 28, 2022

A NodeJS Replit API package wrapped around GraphQL, returning JSON data for easy use.

repl-api.js A NodeJS Replit API package wrapped around GraphQL, returning JSON data for easy use. Contents: About Quickstart Pre-installation Installa

May 20, 2022

Monolithic repo for api server, image server, web server

Onsecondary Market Deployed at https://market.onsecondary.com Monolithic repo for api server, image server, web server TODO -use a script to cull expi

Jan 11, 2022

An express-ve way to start an express project

Express-ve express starter An express-ve way to start an express project. Checkout a demo project here or Learn how to use express-ve here Are you sta

Mar 28, 2022

Json-parser - A parser for json-objects without dependencies

Json Parser This is a experimental tool that I create for educational purposes, it's based in the jq works With this tool you can parse json-like stri

Jan 3, 2022

Pretty-print-json - 🦋 Pretty-print JSON data into HTML to indent and colorize (written in TypeScript)

Pretty-print-json - 🦋 Pretty-print JSON data into HTML to indent and colorize (written in TypeScript)

pretty-print-json Pretty-print JSON data into HTML to indent and colorize (written in TypeScript) 1) Try It Out Interactive online tool to format JSON

Dec 30, 2022
Owner
Vitor
Software engineer | JS, TS, Rust and working with Solana blockchain
Vitor
next-graphql-server is a library for building production-grade GraphQL servers using Next.js with API Routes

next-graphql-server next-graphql-server is an easy to use Next.js library for creating performant GraphQL endpoints on top of Next.js API Routes. Star

Jakub Neander 82 Nov 21, 2022
JCS (JSON Canonicalization Scheme), JSON digests, and JSON Merkle hashes

JSON Hash This package contains the following JSON utilties for Deno: digest.ts provides cryptographic hash digests of JSON trees. It guarantee that d

Hong Minhee (洪 民憙) 13 Sep 2, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
Create a maintainable and scalable Node.js GraphQL API with TypeScript, Express, Mongoose and Apollo Server.

Set up and build a Node.js GraphQL API using Typescript, Express, Mongoose with a maintainable and scalable structure

Adam Khomsi 7 Nov 4, 2022
Prisma 2+ generator to emit a JSON file that can be run with json-server

Prisma JSON Server Generator A Prisma generator that automates creating a JSON file that can be run as a server from your Prisma schema. Explore the o

Omar Dulaimi 14 Jan 7, 2023
A CRUD implementation using sequelize, mySQL, NODEJS, Express, JWT and other technologies.

A ideia do projeto é simular o funcionamento do backend de um blog através da implementação de uma aplicação em Node.js usando o pacote sequelize para

Vinicius Savordelli 6 May 11, 2022
A full CRUD application built using the MELN(MongoDB,Express,LiquidJS,Node) stack.

Pokedex Your mission is to be the very best, like no one ever was, at making a Pokémon manager (a Pokédex). Learning Objectives Full CRUD App Prerequi

Anthony Njoroge 5 Sep 23, 2022
CRUD APIs in NodeJS, Express and MySQL

Create CRUD APIs in NodeJS, Express and MySQL This is a simple NodeJS, Express and MySQL CRUD API example. that allows you to create, read, update and

Hala Ziani 5 Oct 19, 2022
CRUD de productos basado en el ORM sequelize y el login y el registro usando archivo en formato JSON.

Desarrollo de una aplicación muy sencilla, utilizando diferentes recursos ofrecdos por Node.JS. Aquí puedes encontrar : Login - Registro - Administración de productos completamente funcionales) Recursos utilizados: Middleware - Express validator - Validaciones del lado del Front-End - y del Back-End - Sessión - Cookies - Multer, entre otros)

Ángel Daniel Fuentes Segura 4 Sep 12, 2022
Deploying Fake Back-End Server & DataBase Using JSON-SERVER, GitHub, and Heroku

Deploying Fake Back-End Server & DataBase Using JSON-SERVER, GitHub, and Heroku. In this article, we will create and host a fake server that we can de

Israel David 0 Sep 5, 2022