This project is about creating, reading, and manipulating data from SQL database. Front as React and maybe React Native.
- Copy .env.example to .env and fill with your data.
The project is divided into two main folders:
server
: This folder contains the Express server that handles the API requests from SQL.client
: This folder contains the React application that interacts with the server.
The server is built with Express.js, SQL and provides the following endpoints:
GET /api/exp_all
: Fetches all expenses from the database.DELETE /api/exp/:id
: Deletes a expense with the specified ID from the database.POST /api/exp
: Adds a new expense to the database.PUT /api/exp/:id
: Updates the expense with the specified ID in the database.
You can import "exp_DB.sql" file from "./server/src/db" to your database and test it locally.
The client is a React application that provides a user interface for interacting with the server's endpoints. It allows you to view all expenses, delete a expenses, add a new expense and update a expenses's information.
You need local setup of SQL DB
To install the application, follow these steps:
- Clone the repository.
- Navigate to the
server
folder and runnpm install
to install the server dependencies. - Import "exp_DB.sql" to your local SQL server.
- Navigate to the
client
folder and runnpm install
to install the client dependencies.
To run the application, follow these steps:
- In the
server
folder, runnpm run dev
to start the server. - In the
client
folder, runnpm run dev
to start the client.
The client will be accessible at http://localhost:5173
, and the server will run at http://localhost:3000
.