@adonisjs-community/girouette
Version:
An AdonisJS package allowing decorators-based routing.
73 lines (72 loc) • 2.73 kB
TypeScript
/**
* Decorator for GET requests in AdonisJS v6
* @param pattern The route pattern
* @param name Optional name for the route
* @example
* // In an AdonisJS v6 controller:
* @Get('/users')
* async index({ response }: HttpContext) {
* // Handle GET request for /users
* }
*/
export declare const Get: (pattern: string, name?: string) => (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
/**
* Decorator for POST requests in AdonisJS v6
* @param pattern The route pattern
* @param name Optional name for the route
* @example
* // In an AdonisJS v6 controller:
* @Post('/users')
* async store({ request, response }: HttpContext) {
* // Handle POST request for /users
* }
*/
export declare const Post: (pattern: string, name?: string) => (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
/**
* Decorator for PUT requests in AdonisJS v6
* @param pattern The route pattern
* @param name Optional name for the route
* @example
* // In an AdonisJS v6 controller:
* @Put('/users/:id')
* async update({ params, request, response }: HttpContext) {
* // Handle PUT request for /users/:id
* }
*/
export declare const Put: (pattern: string, name?: string) => (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
/**
* Decorator for PATCH requests in AdonisJS v6
* @param pattern The route pattern
* @param name Optional name for the route
* @example
* // In an AdonisJS v6 controller:
* @Patch('/users/:id')
* async partialUpdate({ params, request, response }: HttpContext) {
* // Handle PATCH request for /users/:id
* }
*/
export declare const Patch: (pattern: string, name?: string) => (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
/**
* Decorator for DELETE requests in AdonisJS v6
* @param pattern The route pattern
* @param name Optional name for the route
* @example
* // In an AdonisJS v6 controller:
* @Delete('/users/:id')
* async destroy({ params, response }: HttpContext) {
* // Handle DELETE request for /users/:id
* }
*/
export declare const Delete: (pattern: string, name?: string) => (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
/**
* Decorator for handling any HTTP method in AdonisJS v6
* @param pattern The route pattern
* @param name Optional name for the route
* @example
* // In an AdonisJS v6 controller:
* @Any('/wildcard')
* async handleAnyMethod({ request, response }: HttpContext) {
* // Handle any HTTP method for /wildcard
* }
*/
export declare const Any: (pattern: string, name?: string) => (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;