https://github.com/leafycodes/express-rest-api-mysql
This project is an API (MySQL, Express.js, Node.js) application with SQL and EJS integration. It provides a CRUD-based system for managing and displaying database records using a RESTful API.
https://github.com/leafycodes/express-rest-api-mysql
api backend ejs express html javascript mern nodejs webdevelopment
Last synced: 7 months ago
JSON representation
This project is an API (MySQL, Express.js, Node.js) application with SQL and EJS integration. It provides a CRUD-based system for managing and displaying database records using a RESTful API.
- Host: GitHub
- URL: https://github.com/leafycodes/express-rest-api-mysql
- Owner: leafycodes
- Created: 2025-06-04T13:58:36.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-06-08T07:30:45.000Z (8 months ago)
- Last Synced: 2025-07-04T01:36:48.039Z (7 months ago)
- Topics: api, backend, ejs, express, html, javascript, mern, nodejs, webdevelopment
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# SQL-MERN Stack Project
This project is an API (MySQL, Express.js, Node.js) application with SQL and EJS integration. It provides a CRUD-based system for managing and displaying database records using a RESTful API.
## 🧩 Tech Stack
- **Frontend**: basic HTML/EJS
- **Backend**: Express.js (Node.js)
- **Database**: MySQL (using `mysql2` package)
## 🚀 Getting Started
### Prerequisites
- Node.js
- MySQL
- npm
- Express.js
- uuid
- @faker-js/faker
- method-override
### Setup
1. Clone the repo:
```bash
git clone https://github.com/leafycodes/express-rest-api-mysql.git
cd express-rest-api-mysql
```
2. Install backend dependencies:
```bash
cd express-rest-api-mysql
npm install
```
3. Setup your MySQL database:
- Create a database and table as expected by the code.
- Update the credentials inside server/database using faker template provided in index.js.
4. Start the server and visit `http://localhost:8080/`
## API endpoints:
- `GET /users` — fetch all users
- `POST /users` — create a new user
- `PATCH /users/:id` — update username if the password is correct
- `DELETE /users/:id` — delete user if password is correct