omni-rest-express-example
v1.0.0
Published
Express.js example using omni-rest for auto-generated REST APIs
Readme
omni-rest Express Example
A complete Express.js server using omni-rest for auto-generated REST APIs with validation and OpenAPI documentation.
Setup
- Install dependencies:
npm install- Set up the database:
npm run db:push
npm run db:generate- Seed the database:
npm run db:seed- Start the server:
npm run devThe server will run on http://localhost:3000
API Endpoints
All CRUD operations are automatically available:
GET /api/departments- List departmentsPOST /api/departments- Create departmentGET /api/departments/:id- Get department by IDPUT /api/departments/:id- Update departmentPATCH /api/departments/:id- Partially update departmentDELETE /api/departments/:id- Delete department
Same for categories, products, and cities.
Features
- ✅ Auto-generated REST APIs
- ✅ Zod validation on all requests
- ✅ OpenAPI 3.0 documentation at
/docs - ✅ Swagger UI for testing
- ✅ TypeScript support
- ✅ Database relationships handled automatically
Testing the API
Visit http://localhost:3000/docs to see the interactive API documentation and test endpoints.
