A basic Moro framework demonstration showing fundamental concepts like routing, validation, and API development.
- 🔄 CRUD operations with in-memory storage
- Zod validation for type safety
- Zero-config setup
- Health checks and error handling
- Simple testing endpoints
When working in the MoroJS monorepo (has ../../MoroJS directory):
npm install # Uses local MoroJS source automatically
npm run dev # Real-time TypeScript developmentWhen using this example standalone:
npm run install:external # Installs moro from npm
npm run dev # Runs with published packageThat's it! No setup scripts, no complexity. The package.json is pre-configured for local development, but you can easily switch to the npm package when needed.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Welcome message and API overview |
GET |
/health |
Health check |
GET |
/users |
List all users (with optional filtering) |
POST |
/users |
Create a new user |
GET |
/users/:id |
Get user by ID |
# Get welcome message
curl http://localhost:3001/
# List users
curl http://localhost:3001/users
# Create a user
curl -X POST http://localhost:3001/users \
-H "Content-Type: application/json" \
-d '{"name": "Alice Johnson", "email": "alice@example.com", "age": 28}'
# Get specific user
curl http://localhost:3001/users/1
# Search users
curl "http://localhost:3001/users?search=john&limit=5"{
"users": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"age": 30
}
],
"total": 1,
"filters": {
"search": "john",
"limit": 5
}
}- Intelligent Routing: Chainable API with automatic middleware ordering
- Zod Validation: Type-safe request validation with
UserSchema - Functional Architecture: Pure functions, no decorators
- Error Handling: Proper HTTP status codes and error responses
npm run dev- Start development servernpm run dev:watch- Start with auto-restart on file changesnpm run install:external- Switch to using npm package instead of local sourcenpm run build- Build for productionnpm run start- Run built version
- Explore Feature Showcase for advanced patterns
- Try Enterprise App for modular architecture
- Check out Microservices for distributed systems