Skip to content

Commit 7c3c563

Browse files
committed
fix: types
1 parent ba059af commit 7c3c563

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

zerva-http/src/http.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { HelmetOptions } from 'helmet'
1313
import type { AddressInfo } from 'node:net'
1414
import type { LogConfig } from 'zeed'
1515
import { compressionMiddleware } from './compression'
16-
import type { Express, NextFunction, Request, Response, Server, zervaHttpGetHandler, zervaHttpHandlerModes, zervaHttpInterface, zervaHttpPaths } from './types'
16+
import type { Express, NextFunction, Request, Response, Server, zervaHttpGetHandler, zervaHttpHandlerModes, zervaHttpInterface, zervaHttpPaths, ZervaHttpRouteDescription } from './types'
1717

1818
export * from './status'
1919
export * from './types'
@@ -179,12 +179,6 @@ export function useHttp(config?: {
179179
log.error('client request error', err)
180180
})
181181

182-
interface ZervaHttpRouteDescription {
183-
path: string
184-
method: string
185-
description: string
186-
}
187-
188182
const routes: ZervaHttpRouteDescription[] = []
189183

190184
function smartRequestHandler(
@@ -365,6 +359,7 @@ export function useHttp(config?: {
365359
return {
366360
app,
367361
http: server,
362+
routes,
368363
get: GET,
369364
post: POST,
370365
put: PUT,

zerva-http/src/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ export type zervaHttpGetHandler =
2323
req: Request
2424
}), res: Response, next: NextFunction) => Promise<zervaHttpResultPrimaryTypes> | zervaHttpResultPrimaryTypes)
2525

26+
export interface ZervaHttpRouteDescription {
27+
path: string
28+
method: string
29+
description: string
30+
}
31+
2632
export interface zervaHttpInterface {
2733
/** Express app */
2834
app: Express
2935

3036
/** Node http */
3137
http: Server
3238

39+
/** Reflects the registeres routes */
40+
routes: ZervaHttpRouteDescription[]
41+
3342
/** GET */
3443
get: (this: void, path: zervaHttpPaths, ...handlers: zervaHttpGetHandler[]) => void
3544

0 commit comments

Comments
 (0)