This project demonstrates the alternatives to REST API by implementing both REST and GraphQL type request handling projects using the MERN stack.
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.
Follow these steps to install and set up the project:
- Clone the repository.
- Navigate to the project directory.
- Run
bun install
ornpm install
to install the dependencies. - Set up the required environment variables.
- Run
bun run start
script ornpm start
to start the server.
To use the project, follow these instructions:
- Make requests to the REST API endpoints to interact with the RESTful part of the project.
- Make requests to the GraphQL endpoint to interact with the GraphQL part of the project.
- Refer to the project documentation for detailed information on the available endpoints and request formats.
query {
clients{
name
}
}
mutation{
addClient(name: "Ayush Tickoo", email: "ayush.tickoo@reazon.com", phone: "9914188982") {
name,
phone,
id
}
}
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
}
}
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your changes to your forked repository.
- Submit a pull request to the main repository.