@bunito/http
v0.0.15
Published
HTTP module with controllers, routing, middleware, CORS, validation, and exceptions.
Maintainers
Readme
@bunito/http
HTTP module for bunito applications.
It provides route decorators, request injections, middleware, CORS, body parsing, JSON serialization, validation helpers, and HTTP exceptions for controllers.
Installation 📦
bun add @bunito/httpUsage ✨
import { Controller, Module } from '@bunito/bunito';
import {
Get,
HTTPModule,
JSONSerializer,
UseCORS,
UseMiddleware,
} from '@bunito/http';
@Controller('/hello')
@UseMiddleware(JSONSerializer)
@UseCORS()
class HelloController {
@Get()
hello(): Record<string, string> {
return {
message: 'Hello from HTTP',
};
}
}
@Module({
imports: [HTTPModule],
controllers: [HelloController],
})
class AppModule {}License
MIT
