Decoratorsv0.1.5
@tekir/http-decorators
@Controller, @Get, @Post, @Put, @Delete, @Middleware, @Cache.
Installation
$
bun add @tekir/http-decoratorsFeatures
- @Controller('/path') class decorator
- @Get, @Post, @Put, @Delete, @Patch route decorators
- @Middleware for per-method middleware
- @Cache for response caching on a controller method
- @Websocket for WebSocket routes
- ControllerManager for auto-registration
Quick Example
TypeScript
import { Controller, Get, Cache } from '@tekir/http-decorators'
@Controller('/api/posts')
class PostsController {
@Get('/')
@Cache({ ttl: 60 })
async list() { return Post.all() }
}Changelog
v0.1.5LatestSeptember 16, 2026
- The cache decorator now loads its optional cache integration through portable ESM resolution.
- Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.4July 23, 2026
- Cache decorators resolve their optional cache peer from the package module consistently instead of depending on the caller's runtime resolution base.
v0.1.2June 13, 2026
- Controller loading is now resilient. A controller whose constructor throws is skipped with a named warning instead of aborting registration, a method that is not actually a function is skipped, and the remaining routes still register.
- A subclass no longer shares its parent's
__routesarray; it inherits a copy, so adding routes on a subclass cannot mutate the parent. - Importing
@tekir/http-decoratorsno longer pulls in@tekir/cache; the cache dependency is loaded lazily only when@Cache(...)is actually used, with a clear error if the package is missing.@Websocketroutes now warn that they are skipped instead of disappearing silently. - Found and fixed with Fable.
v0.1.1April 29, 2026
- Added the
@Cachedecorator. It is a thin wrapper around@Middleware([cache(opts)])from@tekir/cache, so controller methods can opt into HTTP response caching with a single line.
v0.1.0April 1, 2026
- Initial release