@tinyhttp/app 2.0.26 → 2.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extend.d.ts +1 -1
- package/dist/response.d.ts +21 -21
- package/package.json +3 -3
package/dist/extend.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import { App } from './app.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Extends Request and Response objects with custom properties and methods
|
|
7
7
|
*/
|
|
8
|
-
export declare const extendMiddleware: <EngineOptions>(app: App) => (req: Request, res: Response<EngineOptions>, next: NextFunction) => void;
|
|
8
|
+
export declare const extendMiddleware: <EngineOptions>(app: App) => (req: Request, res: Response<EngineOptions, any>, next: NextFunction) => void;
|
package/dist/response.d.ts
CHANGED
|
@@ -11,30 +11,30 @@ export declare const renderTemplate: <O>(_req: Request, res: Response, app: App)
|
|
|
11
11
|
viewsFolder: string;
|
|
12
12
|
_locals: Record<string, any>;
|
|
13
13
|
}>) => Response;
|
|
14
|
-
export interface Response<O = any> extends ServerResponse {
|
|
15
|
-
header(field: string | Record<string, unknown>, val?: string | any[]): Response
|
|
16
|
-
set(field: string | Record<string, unknown>, val?: string | any[]): Response
|
|
14
|
+
export interface Response<O = any, B = any> extends ServerResponse {
|
|
15
|
+
header(field: string | Record<string, unknown>, val?: string | any[]): Response<O, B>;
|
|
16
|
+
set(field: string | Record<string, unknown>, val?: string | any[]): Response<O, B>;
|
|
17
17
|
get(field: string): string | number | string[];
|
|
18
|
-
send(body:
|
|
19
|
-
sendFile(path: string, options?: ReadStreamOptions, cb?: (err?: any) => void): Response
|
|
20
|
-
json(body:
|
|
21
|
-
status(status: number): Response
|
|
22
|
-
sendStatus(statusCode: number): Response
|
|
18
|
+
send(body: B): Response<O, B>;
|
|
19
|
+
sendFile(path: string, options?: ReadStreamOptions, cb?: (err?: any) => void): Response<O, B>;
|
|
20
|
+
json(body: B): Response<O, B>;
|
|
21
|
+
status(status: number): Response<O, B>;
|
|
22
|
+
sendStatus(statusCode: number): Response<O, B>;
|
|
23
23
|
cookie(name: string, value: string | Record<string, unknown>, options?: SerializeOptions & Partial<{
|
|
24
24
|
signed: boolean;
|
|
25
|
-
}>): Response
|
|
26
|
-
clearCookie(name: string, options?: SerializeOptions): Response
|
|
27
|
-
location(url: string): Response
|
|
25
|
+
}>): Response<O, B>;
|
|
26
|
+
clearCookie(name: string, options?: SerializeOptions): Response<O, B>;
|
|
27
|
+
location(url: string): Response<O, B>;
|
|
28
28
|
links(links: {
|
|
29
29
|
[key: string]: string;
|
|
30
|
-
}): Response
|
|
31
|
-
render(file: string, data?: Record<string, any>, options?: TemplateEngineOptions<O>): Response
|
|
32
|
-
vary(field: string): Response
|
|
33
|
-
format(obj: FormatProps): Response
|
|
34
|
-
redirect(url: string, status?: number): Response
|
|
35
|
-
type(type: string): Response
|
|
36
|
-
download(path: string, filename: string, options?: DownloadOptions, cb?: (err?: any) => void): Response
|
|
37
|
-
attachment(filename?: string): Response
|
|
30
|
+
}): Response<O, B>;
|
|
31
|
+
render(file: string, data?: Record<string, any>, options?: TemplateEngineOptions<O>): Response<O, B>;
|
|
32
|
+
vary(field: string): Response<O, B>;
|
|
33
|
+
format(obj: FormatProps): Response<O, B>;
|
|
34
|
+
redirect(url: string, status?: number): Response<O, B>;
|
|
35
|
+
type(type: string): Response<O, B>;
|
|
36
|
+
download(path: string, filename: string, options?: DownloadOptions, cb?: (err?: any) => void): Response<O, B>;
|
|
37
|
+
attachment(filename?: string): Response<O, B>;
|
|
38
38
|
app?: App;
|
|
39
39
|
locals?: Record<string, any>;
|
|
40
40
|
/**
|
|
@@ -44,6 +44,6 @@ export interface Response<O = any> extends ServerResponse {
|
|
|
44
44
|
*
|
|
45
45
|
* @param obj Response object
|
|
46
46
|
*/
|
|
47
|
-
jsonp(obj: any): Response
|
|
48
|
-
append(field: string, value: any): Response
|
|
47
|
+
jsonp(obj: any): Response<O, B>;
|
|
48
|
+
append(field: string, value: any): Response<O, B>;
|
|
49
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinyhttp/app",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.28",
|
|
4
4
|
"description": "0-legacy, tiny & fast web framework as a replacement of Express",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://tinyhttp.v1rtl.site",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@tinyhttp/cookie": "2.0.5",
|
|
36
36
|
"@tinyhttp/proxy-addr": "2.0.5",
|
|
37
|
-
"@tinyhttp/req": "2.0.
|
|
38
|
-
"@tinyhttp/res": "2.0.
|
|
37
|
+
"@tinyhttp/req": "2.0.15",
|
|
38
|
+
"@tinyhttp/res": "2.0.21",
|
|
39
39
|
"@tinyhttp/router": "2.0.6",
|
|
40
40
|
"header-range-parser": "1.1.3",
|
|
41
41
|
"regexparam": "^2.0.1"
|