Skip to content

Commit

Permalink
Fix: handle type and improve package
Browse files Browse the repository at this point in the history
  • Loading branch information
NobleMajo committed Jan 18, 2025
1 parent 01bba57 commit 9f40a1f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "bun-route",
"version": "1.0.15",
"version": "1.1.0",
"description": "A fast, Express-like router for the high-performance bun.serve() HTTP server.",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"description": "A fast, Express-like router for the high-performance bun.serve() HTTP server.",
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
Expand All @@ -20,7 +20,28 @@
"dist"
],
"keywords": [
"bun"
"bun",
"bunjs",
"bun-js",
"serve",
"bunserve",
"bun-serve",
"route",
"bunrouter",
"bun-router",
"bunroute",
"bun-route",
"router",
"express",
"expressjs",
"expresslike",
"express-js",
"express-like",
"http",
"server",
"httpserver",
"typescript",
"opensource"
],
"license": "MIT",
"homepage": "https://github.com/NobleMajo/bun-route",
Expand Down
5 changes: 3 additions & 2 deletions src/router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type Server } from "bun"
import { statSync } from "fs"
import { join } from "path"
import type { Request as BunRequest } from "undici-types"
import { HttpMethod, parseHttpMethods, stringifyHttpMethods, type HttpMethodString } from "./method"
import { isMergeableEndpointRoute, isMergedRequestMiddleware, mergeRequestMiddlewares, unmergeRequestMiddleware, } from "./middleware"
import { ResponseBuilder } from "./responseBuilder"
Expand Down Expand Up @@ -272,7 +273,7 @@ export class Router {
* @returns Bun response, void or a promise of response or void
*/
handle: BunRequestHandler = (
request: Request,
request: BunRequest,
server: Server
) => this.innerHandle(request, server)

Expand All @@ -285,7 +286,7 @@ export class Router {
* @param server A server to handle it on
* @returns Bun response, void or a promise of response or void
*/
private innerHandle(request: Request, server: Server): Awaitable<Response> {
innerHandle(request: BunRequest, server: Server): Awaitable<Response> {
const res = new ResponseBuilder()
const req = request as Request
req.httpMethod = parseHttpMethods(req.method)
Expand Down

0 comments on commit 9f40a1f

Please sign in to comment.