Comparing version
@@ -10,2 +10,4 @@ import { IncomingMessage, ServerResponse } from 'http'; | ||
declare type LazyHandle = () => Handle | Promise<Handle>; | ||
declare const defineHandle: <T>(handler: Handle<T>) => Handle<T>; | ||
declare const defineMiddleware: (middleware: Middleware) => Middleware; | ||
declare function promisifyHandle(handle: Handle | Middleware): PHandle; | ||
@@ -230,2 +232,6 @@ declare function callHandle(handle: Middleware, req: IncomingMessage, res: ServerResponse): Promise<unknown>; | ||
declare function useQuery(req: IncomingMessage): ufo.QueryObject; | ||
declare type HTTPMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE'; | ||
declare function useMethod(req: IncomingMessage, defaultMethod?: HTTPMethod): HTTPMethod; | ||
declare function isMethod(req: IncomingMessage, expected: HTTPMethod | HTTPMethod[], allowHead?: boolean): boolean; | ||
declare function assertMethod(req: IncomingMessage, expected: HTTPMethod | HTTPMethod[], allowHead?: boolean): void; | ||
@@ -237,2 +243,2 @@ declare function send(res: ServerResponse, data: any, type?: string): Promise<unknown>; | ||
export { App, AppOptions, AppUse, H3Error, Handle, InputLayer, InputStack, Layer, LazyHandle, MIMES, Matcher, Middleware, PHandle, Stack, appendHeader, callHandle, createApp, createError, createHandle, defaultContentType, lazyHandle, promisifyHandle, send, sendError, sendRedirect, setCookie, use, useBase, useBody, useCookie, useCookies, useQuery, useRawBody }; | ||
export { App, AppOptions, AppUse, H3Error, HTTPMethod, Handle, InputLayer, InputStack, Layer, LazyHandle, MIMES, Matcher, Middleware, PHandle, Stack, appendHeader, assertMethod, callHandle, createApp, createError, createHandle, defaultContentType, defineHandle, defineMiddleware, isMethod, lazyHandle, promisifyHandle, send, sendError, sendRedirect, setCookie, use, useBase, useBody, useCookie, useCookies, useMethod, useQuery, useRawBody }; |
{ | ||
"name": "h3", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Tiny JavaScript Server", | ||
@@ -24,4 +24,4 @@ "repository": "unjs/h3", | ||
"lint": "eslint --ext ts .", | ||
"profile": "0x -o -D .profile -P 'autocannon -c 100 -p 10 -d 40 http://localhost:$PORT' ./hello.js", | ||
"release": "yarn test && yarn build && standard-version && npm publish && git push --follow-tags", | ||
"profile": "0x -o -D .profile -P 'autocannon -c 100 -p 10 -d 40 http://localhost:$PORT' ./hello.js", | ||
"test": "yarn lint && jest" | ||
@@ -39,7 +39,7 @@ }, | ||
"connect": "latest", | ||
"cookie": "latest", | ||
"cookie-es": "latest", | ||
"destr": "latest", | ||
"eslint": "latest", | ||
"express": "latest", | ||
"get-port": "latest", | ||
"get-port": "^5.0.0", | ||
"jest": "latest", | ||
@@ -46,0 +46,0 @@ "jiti": "latest", |
@@ -101,2 +101,7 @@ [](https://npmjs.com/package/h3) | ||
- `sendError(res, error, debug?)` | ||
- `defineHandle(handle)` | ||
- `defineMiddleware(middlware)` | ||
- `useMethod(req, default?)` | ||
- `isMethod(req, expected, allowHead?)` | ||
- `assertMethod(req, expected, allowHead?)` | ||
@@ -103,0 +108,0 @@ 👉 You can learn more about usage in [JSDocs Documentation](https://www.jsdocs.io/package/h3#package-functions). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51668
4.95%1417
4.58%125
4.17%