#Project context
This project was my hands-on introduction to building a full CRUD REST API with a relational database.
The target was clear: create endpoints for a car resource, connect them to MySQL, and test the full flow with Postman.
At the time, I was focused on one thing: understanding the full request lifecycle from HTTP call to SQL execution and back to JSON response.
#Tech stack
- Node.js
- Express
- MySQL (
mysqlpackage) - Postman for endpoint validation
- SQL procedures in
forcars.sql
The API listens on port 3000 and connects to a local MySQL database called forcars.
#Endpoints implemented
The API includes the core CRUD operations:
GET /cars-> list all carsGET /cars/:id-> fetch one car bycarIDPOST /cars-> create a new car (throughcarAdd()procedure)PUT /cars-> update a car (throughcarEdit()procedure)DELETE /cars/:id-> delete bycarID
I intentionally kept the route design simple so I could focus on query correctness and data flow.
#How data moves through the app
When a request hits an endpoint, Express parses JSON body data, then calls MySQL queries with parameter binding.
For create and update, I used stored procedures instead of inline SQL. This was useful for learning separation of concerns:
- API layer handles transport and request parsing.
- Database layer handles insert/update rules.
The request-response cycle looks like this:
- Postman sends HTTP request.
- Express route handler receives params/body.
- MySQL query or procedure executes.
- API returns JSON message or result set.
Seeing this loop work reliably was the moment backend development started to feel real for me.
#What I learned while debugging
#1. Connection setup is half the job
The app prints Connected to Database! when successful. If that message did not appear, endpoint testing was pointless.
I learned to verify infrastructure first, then application logic.
#2. Input shape matters
For POST and PUT, body fields had to match expected keys exactly (type, brand, license_plate, and carID for update). Small naming mismatches caused silent confusion.
#3. SQL and API should speak the same language
I had to keep field names and procedure parameters aligned between JavaScript and MySQL. Once they drift, debugging becomes guesswork.
#4. Postman is not just for demos
Using Postman systematically made testing faster:
- Happy path calls
- Missing field cases
- Invalid ID scenarios
- Repeated updates and deletes
It gave me confidence that behavior was consistent, not accidental.
#Notable implementation details
A few points in the code are worth calling out:
express.json()andexpress.urlencoded()are enabled so body parsing is stable.- Parameterized SQL is used for ID-based routes to reduce injection risk.
- Stored procedures (
carAdd,carEdit) are invoked with multi-statement queries.
This project is early-stage code, so there are places I would harden now, but the structure taught the right fundamentals.
#If I rebuilt this today
I would keep the same scope and improve production readiness:
- Move DB credentials to environment variables (
.env) - Replace raw callback patterns with async/await
- Add schema validation with
zodorjoi - Return consistent HTTP status codes and error objects
- Add integration tests with a test database
- Containerize API + DB with Docker Compose
I would also split routes/controllers/services for cleaner code organization as the API grows.
#Why this project still matters in my portfolio
This is a small backend project, but it shows core engineering behavior:
- Build minimal, complete functionality
- Validate it through explicit API tests
- Learn from operational and schema mismatches
- Improve iteration by iteration
For junior backend roles, that process matters more than writing a very large codebase once.
#SEO relevance
If you are searching for a Node.js REST API with MySQL and Postman example, this project is a practical starting point. It covers core CRUD patterns, stored procedure integration, and end-to-end request testing without overcomplicating the stack.
It is useful for students and early-career developers who want a project they can understand, run locally, and extend.
#Repository
Source code and SQL script are available here:
