vapor
Installation
SKILL.md
Vapor Best Practices
1. Concurrency
- ALWAYS use Swift Concurrency (
async/await) overEventLoopFuture. - All route handlers MUST be annotated with
@Sendable.
2. Controllers & Routing
- Organize routes into
RouteCollectionconformances. - Do not put logic in
routes.swift; delegate immediately to a Controller. - Group routes by feature (e.g.,
UsersController,AuthController). - Register controllers:
app.register(collection: MyController()). - API versioning:
app.grouped("api", "v1").
3. Middleware
- Use
AsyncMiddlewarefor custom middleware: