This Node.js application provides GraphQL APIs for managing blog-related functionalities. It includes features such as user authentication, blog creation, editing, and deletion, image uploads, error handling, and utilizes Express.js as the web framework with GraphQL for enhanced flexibility in data retrieval. Below is a comprehensive guide on installation, usage, configuration, features, dependencies, and contributing.
First, clone the repository to your local machine:
git clone [email protected]:ibrahimahmed237/Blog-APIs-GraphQl.git
Navigate to the project directory and install the dependencies:
npm install
To start the application, run:
npm start
Access the GraphQL playground at http://localhost:{PORT}/graphql to interact with the GraphQL APIs.
The application requires several environment variables to be set for proper functioning. Create a .env file in the root directory and add the following variables:
- PORT: The port number the API will listen on. (e.g. PORT=8080)
- MONGO_URI: The connection URL for the MongoDB database.
- JWT_SECRET: The secret key for JWT authentication.
- CLOUDINARY_NAME: The name of your Cloudinary account.
- CLOUDINARY_API_KEY: The API key for your Cloudinary account.
- CLOUDINARY_API_SECRET: The API secret for your Cloudinary account.
- NODE_ENV: The environment in which the application is running. (e.g. NODE_ENV=development)
- OTHER_ENV_VARIABLES: (Add any other environment variables required by your application)
- User Authentication:
- Users can securely register with their email and password.
- Robust authentication with password hashing ensures user security.
- Blog Management:
- Users can create, edit, and delete blog posts.
- Thorough validation ensures data integrity.
- Image Handling:
- Support for uploading images associated with blog posts.
- Utilizes a suitable image processing library.
- Cloudinary Integration:
- Utilizes Cloudinary for managing and storing images.
- GraphQL APIs:
- Utilizes GraphQL for flexible and efficient data retrieval.
- Define GraphQL schemas and resolvers for interacting with the application data.
- Error Handling and Notifications:
- Custom error pages for common HTTP status codes.
- Effective user notifications through appropriate error handling.
- Security Measures:
- Implements necessary security measures to protect against common vulnerabilities.
- Developed using Express.js as the web framework.
- MongoDB for data storage.
- Utilizes GraphQL for enhanced API interactions.
- Other dependencies...
- Express.js: For handling server and routes.
- bcrypt: For hashing passwords and ensuring user security.
- mongoose: For modeling and managing application data.
- graphql, express-graphql: For implementing GraphQL APIs.
- Other dependencies...
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.