Comparing version 0.5.1 to 0.6.0
@@ -39,7 +39,10 @@ /// <reference types="node" /> | ||
StyleSheetString(content: string): Response; | ||
NotFound(headers?: {}): Response; | ||
BadRequest(): Response; | ||
Unauthorized(): Response; | ||
Forbidden(content?: string): Response; | ||
NotFound(headers?: {}): Response; | ||
MethodNotAllowed(): Response; | ||
NotAcceptable(): Response; | ||
Conflict(content?: string): Response; | ||
Internalservererror(content?: string): Response; | ||
InternalServerError(content?: string): Response; | ||
}; | ||
@@ -46,0 +49,0 @@ declare class Base extends Array { |
@@ -65,2 +65,5 @@ "use strict"; | ||
const Response = { | ||
// | ||
// 2xx | ||
// | ||
OK(body, headers = {}) { | ||
@@ -140,8 +143,10 @@ return { headers, body, statusCode: 200 }; | ||
}, | ||
NotFound(headers = {}) { | ||
// | ||
// 4xx | ||
// | ||
BadRequest() { | ||
return { | ||
statusCode: 404, | ||
type: 'text/html', | ||
headers, | ||
body: "Not Found" | ||
statusCode: 400, | ||
headers: {}, | ||
body: '' | ||
}; | ||
@@ -162,2 +167,24 @@ }, | ||
}, | ||
NotFound(headers = {}) { | ||
return { | ||
statusCode: 404, | ||
type: 'text/html', | ||
headers, | ||
body: "Not Found" | ||
}; | ||
}, | ||
MethodNotAllowed() { | ||
return { | ||
statusCode: 405, | ||
headers: {}, | ||
body: "" | ||
}; | ||
}, | ||
NotAcceptable() { | ||
return { | ||
statusCode: 406, | ||
headers: {}, | ||
body: "" | ||
}; | ||
}, | ||
Conflict(content = '') { | ||
@@ -169,3 +196,6 @@ return { | ||
}, | ||
Internalservererror(content = '') { | ||
// | ||
// 5xx | ||
// | ||
InternalServerError(content = '') { | ||
return { | ||
@@ -172,0 +202,0 @@ statusCode: 500, |
@@ -1,4 +0,3 @@ | ||
import { LocalMiddleware, Params } from '../types'; | ||
import * as z from 'zod'; | ||
import { ParseParams } from 'zod/lib/cjs/parser'; | ||
export declare const Validating: <T extends Params>(schema: z.ZodType<T, z.ZodTypeDef, T>, options?: ParseParams) => LocalMiddleware; | ||
export declare const Validating: (schema: z.ZodSchema<unknown>, options?: ParseParams) => (next: any) => (request: any) => Promise<any>; |
@@ -7,10 +7,10 @@ /// <reference types="node" /> | ||
} | ||
export declare type Next = <T extends Params = Params>(request?: Request<T>) => Response | Promise<Response>; | ||
export interface Request<T extends Params = Params> { | ||
params: T; | ||
headers: { | ||
export declare type Next = (request?: Request) => Response | Promise<Response>; | ||
export interface Request { | ||
params: Params; | ||
headers?: { | ||
[name: string]: any; | ||
}; | ||
files: { | ||
[key: string]: { | ||
files?: { | ||
[name: string]: { | ||
name: string; | ||
@@ -17,0 +17,0 @@ length: number; |
{ | ||
"name": "retes", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "Typed, Declarative, Data-Driven Routing for Node.js", | ||
@@ -8,2 +8,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"prepublishOnly": "tsc", | ||
"watch": "tsc -w", | ||
@@ -15,3 +16,3 @@ "build": "tsc", | ||
"author": "", | ||
"license": "ISC", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
@@ -18,0 +19,0 @@ "busboy": "^0.3.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
1
158158
36