This repository contains a simple project demonstrating CRUD (Create, Read, Update, Delete) operations using a RESTful API built with Node.js, Express.js, and MySQL raw queries.
This project provides a basic RESTful API server for performing CRUD operations on a MySQL database. It utilizes Node.js for server-side scripting, Express.js as the web framework, and MySQL for database operations.
- Create, Read, Update, and Delete operations.
- RESTful API endpoints for interacting with the database.
- Simple and lightweight setup.
- Utilizes MySQL raw queries for database operations.
- Node.js
- MySQL
- npm (Node Package Manager)
-
Clone the repository:
git clone https://github.com/divyarajsinhsindhav/MySQL-CRUD.git
-
Navigate to the project directory:
cd MySQL-CRUD
-
Install dependencies:
npm install
-
Configure MySQL settings in
config.js
file. -
Create the MySQL database and table. You can use the SQL commands provided in
database.sql
file.
-
Start the server:
npm start
-
Access the API endpoints using a tool like Postman or curl.
GET /api/list
- Get all resources.GET /api/list/:id
- Get a specific resource by ID.POST /api/list
- Create a new resource.PUT /api/list/:id
- Update a resource by ID.DELETE /api/list/:id
- Delete a resource by ID.
Contributions are welcome! Feel free to open issues or pull requests for any improvements or features you'd like to add.