This project is a Node.js backend API built with GraphQL for querying and mutating data. It focuses on modularity and scalability, ensuring that the API is easy to maintain and extend. The project follows best practices, such as using Apollo Server for the GraphQL layer, and also includes authentication, authorization, and database interaction functionalities.
- GraphQL API: Interact with the backend using GraphQL.
- Apollo Server: Handles GraphQL requests.
- Node.js & Express: Backend built with Node.js and Express.
- MongoDB: NoSQL database for data storage.
- Modular & Scalable: Easy to add new features and endpoints.
Make sure you have the following installed:
- Node.js (>=18.0.0)
- Clone the repository:
- Navigate to the project directory:
- cd node-rest-graphql-api
- Install dependencies:
- npm install
- npm run dev
The server will start running on http://localhost:4003 (or the port you specified).
Once the application is running, you can test your GraphQL queries and mutations by navigating to the following URL:
This will open up the GraphQL Playground where you can interact with the API by writing GraphQL queries and mutations.
Additionally, we have two Postman collections available at the root of the project:
- GraphQL API.postman_collection.json
- REST API.postman_collection.json
You can easily import these collections into Postman and start testing the respective APIs with pre-configured requests.
To run the tests for the application, you can use the following command:
- npm run test