007tickooayush / express-grql

Nodejs GraphQL project using MERN stack demonstrating the alernatives to REST API, with each REST and GraphQL type request handling projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js GraphQL Project

This project demonstrates the alternatives to REST API by implementing both REST and GraphQL type request handling projects using the MERN stack.

Description

This project showcases the usage of GraphQL alongside the traditional REST API approach. It provides examples of how to handle different types of requests using both REST and GraphQL.

Table of Contents

Installation

Follow these steps to install and set up the project:

  1. Clone the repository.
  2. Navigate to the project directory.
  3. Run bun install or npm install to install the dependencies.
  4. Set up the required environment variables.
  5. Run bun run start script or npm start to start the server.

Usage

To use the project, follow these instructions:

  1. Make requests to the REST API endpoints to interact with the RESTful part of the project.
  2. Make requests to the GraphQL endpoint to interact with the GraphQL part of the project.
  3. Refer to the project documentation for detailed information on the available endpoints and request formats.
  • GraphQL Client read example:

query {
  clients{
    name
  }
}
  • GraphQL Client insert example:

mutation{
  addClient(name: "Ayush Tickoo", email: "ayush.tickoo@reazon.com", phone: "9914188982") {
    name,
    phone,
    id
  }
}
  • GraphQL examples:

mutation{
  addClient(name: "Mike Wazowski", email:"mike.wazowski@monster.inc", phone:"6969696970"){
    id
  }
}

mutation{
  addProject(
    name:"ScreamMeasure",
    description:"Measuring the sound intensity of a scream",
    status: progress,
    clientId:"65aca787046afcc1687ae5b8"
  ){
    id,
    name
  }
}

mutation{
  updateProject(
    id : "65acaad61232c850ab791d3c"
    status: completed
  ) {
    name
    status
  }
}

query{
  projects{
    id
    name
    status
    client{
      name
      email
    }
  }
}

query{
  clients {
    id
    name
  }
}

query{
  client(id:"65aaaea49f2831bd71bc304d"){
    name
    email
  }
}

Contributing

Contributions are welcome! If you would like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your changes to your forked repository.
  5. Submit a pull request to the main repository.

About

Nodejs GraphQL project using MERN stack demonstrating the alernatives to REST API, with each REST and GraphQL type request handling projects


Languages

Language:TypeScript 95.1%Language:HTML 2.0%Language:CSS 1.9%Language:JavaScript 1.1%