A simple blog project using Node.js, Express.js, MySQL, and GraphQL.
- Introduction
- Getting Started
- Running the Application
- Testing GraphQL Endpoints
- Project Structure
- Contributing
- License
This project is a basic blog implementation with features like creating, updating, and deleting blog posts. It utilizes Node.js, Express.js, MySQL for data storage, and GraphQL for efficient querying.
Ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/your-username/blog-project.git
-
Navigate to the project directory:
cd blog-project
-
Install Dependencies:
npm install
Create a MySQL database for the blog project.
Copy the .env.example file to .env and update it with your database credentials.
```bash
DB_HOST=localhost
DB_USER=username
DB_PASSWORD=password
DB_NAME=your_database_name
```bash
npm start
The server will be running at http://localhost:3000.
Use a tool like Postman or GraphQL Playground to test GraphQL endpoints.
Example GraphQL query:
```bash
graphql
Copy code
{
getAllPosts {
id
title
content
comments {
id
text
}
}
}
```bash
├── src
│ ├── controllers
│ ├── db
│ ├── graphql
│ ├── routes
│ ├── index.js
├── .env.example
├── package.json
├── README.md
└── ... (other project files)