This directory contains a fully functional NestJS backend application with a frontend that demonstrates all RESTful API interactions.
🚀 Quick Start
# Install dependencies
npm install
# Start the backend server
npm run start:dev
# Open your browser to http://localhost:3000/public/index.html
📁 Structure
examples/
├── backend/ # NestJS backend application
│ ├── src/
│ │ ├── main.ts
│ │ ├── app.module.ts
│ │ ├── tasks/ # Tasks module (CRUD example)
│ │ └── users/ # Users module (CRUD example)
│ └── ...
├── frontend/ # HTML/CSS/JavaScript frontend
│ ├── index.html
│ ├── styles.css
│ └── app.js
└── README.md
🎯 Features Demonstrated
- ✅ Complete RESTful API (GET, POST, PUT, DELETE, OPTIONS)
- ✅ CORS configuration
- ✅ Request validation
- ✅ Error handling
- ✅ Frontend-backend integration
- ✅ Modern UI with vanilla JavaScript
📝 API Endpoints
Tasks API
GET /api/tasks- Get all tasksGET /api/tasks/:id- Get a specific taskPOST /api/tasks- Create a new taskPUT /api/tasks/:id- Update a taskDELETE /api/tasks/:id- Delete a taskOPTIONS /api/tasks- CORS preflight
Users API
GET /api/users- Get all usersGET /api/users/:id- Get a specific userPOST /api/users- Create a new userPUT /api/users/:id- Update a userDELETE /api/users/:id- Delete a userOPTIONS /api/users- CORS preflight