This is a simple CRUD (Create, Read, Update, Delete) application built with Node.js, Express, and React. This project provides a basic example of how to set up and manage a CRUD interface with a RESTful API and a front-end application.
- Create, Read, Update, and Delete records.
- RESTful API with Express for backend operations.
- React frontend to interact with the API.
- Data persistence with a MySQL database.
- Dynamic table management.
-
Clone the repository:
git clone https://github.com/nandu-99/CRUD.git
-
Install dependencies:
npm install
-
Set up your environment variables. Create a
.env
file in the backend directory with the following content:SQL_DB_HOST= "" SQL_DB_USERNAME="" SQL_DB_PASSWORD="" SQL_DB_DATABASENAME="" PORT=""
-
Start the server:
node index.js
-
Navigate to the frontend directory:
cd crud-operations
-
Install dependencies:
npm install
-
Start the React application:
npm start
-
Locate your
api.js
file in theservices
directory. -
Change the
API_BASE_URL
to:const API_BASE_URL = `http://localhost:${PORT}`;
Make sure to replace
${PORT}
with your actual port number.
- Start both the backend and frontend servers.
- Open your browser and navigate to http://localhost:3000 to access the React frontend.
- Use the provided UI to interact with the CRUD operations.
- Show All Tables: Retrieves and displays all tables present in the database.
- Create Table: Creates a new table with the specified table name and columns.
- Alter Table: Modifies an existing table according to the specified changes.
- Fetch Columns: Shows all the columns present in a specified table.
- Truncate Table: Removes all data from a table while keeping the table structure intact.
- Delete Table: Deletes the entire table, including its structure and data.
- Create Row in Table: Adds a new row of data to a specified table.
- Complete Table Data: Retrieves and displays all data from a specified table.
The frontend is built with React and includes components for listing, creating, updating, and deleting items.
-
Fork the repository.
-
Create a new branch:
git checkout -b feature/YourFeature
-
Commit your changes:
git commit -am 'Add new feature'
-
Push to the branch:
git push origin feature/YourFeature
-
Create a new Pull Request.