Interface HttpServer<TRequest, TResponse>
Type parameters
-
TRequest = any
-
TResponse = any
Methods
createMiddlewareFactory
-
Parameters
Returns ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>
delete
-
Parameters
Returns any
-
Parameters
Returns any
get
-
Parameters
Returns any
-
Parameters
Returns any
Optional getRequestHostname
- getRequestHostname(request: TRequest): string
-
Parameters
Returns string
Optional getRequestMethod
- getRequestMethod(request: TRequest): string
-
Parameters
Returns string
Optional getRequestUrl
- getRequestUrl(request: TResponse): string
-
Parameters
Returns string
head
-
Parameters
Returns any
-
Parameters
Returns any
listen
- listen(port: number | string, callback?: () => void): any
- listen(port: number | string, hostname: string, callback?: () => void): any
-
Parameters
-
port: number | string
-
Optional callback: () => void
Returns any
-
Parameters
-
port: number | string
-
hostname: string
-
Optional callback: () => void
Returns any
options
-
Parameters
Returns any
-
Parameters
Returns any
patch
-
Parameters
Returns any
-
Parameters
Returns any
post
-
Parameters
Returns any
-
Parameters
Returns any
put
-
Parameters
Returns any
-
Parameters
Returns any
redirect
- redirect(response: any, statusCode: number, url: string): any
-
Parameters
-
response: any
-
statusCode: number
-
url: string
Returns any
registerParserMiddleware
- registerParserMiddleware(): any
render
- render(response: any, view: string, options: any): any
-
Parameters
-
response: any
-
view: string
-
options: any
Returns any
reply
- reply(response: any, body: any, statusCode?: number): any
-
Parameters
-
response: any
-
body: any
-
Optional statusCode: number
Returns any
Optional setBaseViewsDir
- setBaseViewsDir(path: string | string[]): this
Optional setErrorHandler
- setErrorHandler(handler: Function, prefix?: string): any
setHeader
- setHeader(response: any, name: string, value: string): any
-
Parameters
-
response: any
-
name: string
-
value: string
Returns any
Optional setNotFoundHandler
- setNotFoundHandler(handler: Function, prefix?: string): any
Optional setViewEngine
- setViewEngine(engineOrOptions: any): this
status
- status(response: any, statusCode: number): any
-
Parameters
-
response: any
-
statusCode: number
Returns any
use
-
Parameters
Returns any
-
Parameters
Returns any
Optional useStaticAssets
- useStaticAssets(...args: any[]): this