Skip to main content

Interface: IHttpRouter

Defined in: service-core/src/http/types.ts:139

Public surface shared by every HTTP router implementation (uWS-backed, Bun-backed, ...). Server.ts depends only on this interface, never on a concrete router class, so the underlying HTTP server can be swapped per-runtime without touching route registration.

Indexable​

[key: string]: any

Properties​

isListening​

readonly isListening: boolean

Defined in: service-core/src/http/types.ts:166


listenPort​

listenPort: number

Defined in: service-core/src/http/types.ts:167

Methods​

close()​

close(): void

Defined in: service-core/src/http/types.ts:158

Stops accepting new connections. Connections that are already open (including keep-alive and WebSocket connections) are left alone.

Returns​

void


delete()​

delete(path, ...handlers): this

Defined in: service-core/src/http/types.ts:144

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


get()​

get(path, ...handlers): this

Defined in: service-core/src/http/types.ts:141

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


hasExplicitOptionsRoute()​

hasExplicitOptionsRoute(path): boolean

Defined in: service-core/src/http/types.ts:153

true if the application has registered its own literal OPTIONS route at path (as opposed to the framework's own internal /* CORS-preflight fallback registered in listen()). Consulted by Server.ts's global CORS middleware so a real app-defined OPTIONS handler gets a chance to run instead of the blanket preflight 204 - see HttpRouter/BunRouter's identical implementations for the full rationale.

Parameters​

path​

string

Returns​

boolean


head(path, ...handlers): this

Defined in: service-core/src/http/types.ts:146

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


listen()​

listen(host, port): Promise<void>

Defined in: service-core/src/http/types.ts:155

Parameters​

host​

string

port​

number

Returns​

Promise<void>


options()​

options(path, ...handlers): this

Defined in: service-core/src/http/types.ts:147

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


patch()​

patch(path, ...handlers): this

Defined in: service-core/src/http/types.ts:145

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


post()​

post(path, ...handlers): this

Defined in: service-core/src/http/types.ts:142

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


put()​

put(path, ...handlers): this

Defined in: service-core/src/http/types.ts:143

Parameters​

path​

string

handlers​

...(HttpRouteOptions | RequestHandler)[]

Returns​

this


shutdown()?​

optional shutdown(timeoutMs): Promise<void>

Defined in: service-core/src/http/types.ts:165

Gracefully shuts the server down: stops accepting new connections, waits up to timeoutMs milliseconds for HTTP requests that are still being handled to finish, then force-closes every remaining connection (keep-alive and WebSocket connections included). Optional, so custom routers without it keep working; Server.stop() falls back to close() for those.

Parameters​

timeoutMs​

number

Returns​

Promise<void>


use()​

use(...handlers): this

Defined in: service-core/src/http/types.ts:140

Parameters​

handlers​

...RequestHandler[]

Returns​

this


ws()​

ws(path, handlers, wsOptions?, upgradeAuth?): this

Defined in: service-core/src/http/types.ts:154

Parameters​

path​

string

handlers​

RequestHandler[]

wsOptions?​

any

upgradeAuth?​

any

Returns​

this