tspace-spear
Version:
tspace-spear is a lightweight, high-performance API framework for Node.js that leverages the native HTTP server and supports uWebSockets.js (C++) for maximum speed and efficiency.
83 lines (82 loc) • 1.79 kB
TypeScript
/**
* Maps a controller method to an HTTP GET route.
*
* @example
* ```ts
* \@Get('/users')
* async list(ctx: T.Context) {
* return [{ id: 1, name: "John" }];
* }
* ```
*/
export declare const Get: (path: `/${string}`) => MethodDecorator;
/**
* Maps a controller method to an HTTP POST route.
*
* @example
* ```ts
* \@Post('/users')
* async create(ctx: T.Context) {
* return { success: true };
* }
* ```
*/
export declare const Post: (path: `/${string}`) => MethodDecorator;
/**
* Maps a controller method to an HTTP PUT route.
*
* Used for replacing a resource.
*
* @example
* ```ts
* \@Put('/users/:id')
* async update(ctx: T.Context) {}
* ```
*/
export declare const Put: (path: `/${string}`) => MethodDecorator;
/**
* Maps a controller method to an HTTP PATCH route.
*
* Used for partially updating a resource.
*
* @example
* ```ts
* \@Patch('/users/:id')
* async patch(ctx: T.Context) {}
* ```
*/
export declare const Patch: (path: `/${string}`) => MethodDecorator;
/**
* Maps a controller method to an HTTP DELETE route.
*
* @example
* ```ts
* \@Delete('/users/:id')
* async remove(ctx: T.Context) {}
* ```
*/
export declare const Delete: (path: `/${string}`) => MethodDecorator;
/**
* Maps a controller method to an HTTP HEAD route.
*
* HEAD responses contain only headers and no response body.
*
* @example
* ```ts
* \@Head('/health')
* async health(ctx: T.Context) {}
* ```
*/
export declare const Head: (path: `/${string}`) => MethodDecorator;
/**
* Maps a controller method to an HTTP OPTIONS route.
*
* Typically used for CORS preflight requests.
*
* @example
* ```ts
* \@Options('/users')
* async options(ctx: T.Context) {}
* ```
*/
export declare const Options: (path: `/${string}`) => MethodDecorator;