docs/ts/runtime/api.mdx
Aborted: "aborted"
Aborted indicates the operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FailedPrecondition, Aborted, and Unavailable.
AlreadyExists: "already_exists"
AlreadyExists means an attempt to create an entity failed because one already exists.
This error code will not be generated by the gRPC framework.
Canceled: "canceled"
Canceled indicates the operation was canceled (typically by the caller).
Encore will generate this error code when cancellation is requested.
DataLoss: "data_loss"
DataLoss indicates unrecoverable data loss or corruption.
This error code will not be generated by the gRPC framework.
DeadlineExceeded: "deadline_exceeded"
DeadlineExceeded means operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.
The gRPC framework will generate this error code when the deadline is exceeded.
FailedPrecondition: "failed_precondition"
FailedPrecondition indicates operation was rejected because the system is not in a state required for the operation's execution. For example, directory to be deleted may be non-empty, an rmdir operation is applied to a non-directory, etc.
A litmus test that may help a service implementor in deciding between FailedPrecondition, Aborted, and Unavailable: (a) Use Unavailable if the client can retry just the failing call. (b) Use Aborted if the client should retry at a higher-level (e.g., restarting a read-modify-write sequence). (c) Use FailedPrecondition if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, FailedPrecondition should be returned since the client should not retry unless they have first fixed up the directory by deleting files from it. (d) Use FailedPrecondition if the client performs conditional REST Get/Update/Delete on a resource and the resource on the server does not match the condition. E.g., conflicting read-modify-write on the same resource.
This error code will not be generated by the gRPC framework.
Internal: "internal"
Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken.
This error code will be generated by the gRPC framework in several internal error conditions.
InvalidArgument: "invalid_argument"
InvalidArgument indicates client specified an invalid argument. Note that this differs from FailedPrecondition. It indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name).
This error code will not be generated by the gRPC framework.
NotFound: "not_found"
NotFound means some requested entity (e.g., file or directory) was not found.
This error code will not be generated by the gRPC framework.
OK: "ok"
OK indicates the operation was successful.
OutOfRange: "out_of_range"
OutOfRange means operation was attempted past the valid range. E.g., seeking or reading past end of file.
Unlike InvalidArgument, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generate InvalidArgument if asked to read at an offset that is not in the range [0,2^32-1], but it will generate OutOfRange if asked to read from an offset past the current file size.
There is a fair bit of overlap between FailedPrecondition and OutOfRange. We recommend using OutOfRange (the more specific error) when it applies so that callers who are iterating through a space can easily look for an OutOfRange error to detect when they are done.
This error code will not be generated by the gRPC framework.
PermissionDenied: "permission_denied"
PermissionDenied indicates the caller does not have permission to execute the specified operation. It must not be used for rejections caused by exhausting some resource (use ResourceExhausted instead for those errors). It must not be used if the caller cannot be identified (use Unauthenticated instead for those errors).
This error code will not be generated by the gRPC core framework, but expect authentication middleware to use it.
ResourceExhausted: "resource_exhausted"
ResourceExhausted indicates some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
This error code will be generated by the gRPC framework in out-of-memory and server overload situations, or when a message is larger than the configured maximum size.
Unauthenticated: "unauthenticated"
Unauthenticated indicates the request does not have valid authentication credentials for the operation.
The gRPC framework will generate this error code when the authentication metadata is invalid or a Credentials callback fails, but also expect authentication middleware to generate it.
Unavailable: "unavailable"
Unavailable indicates the service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations.
See litmus test above for deciding between FailedPrecondition, Aborted, and Unavailable.
This error code will be generated by the gRPC framework during abrupt shutdown of a server process or network connection.
Unimplemented: "unimplemented"
Unimplemented indicates operation is not implemented or not supported/enabled in this service.
This error code will be generated by the gRPC framework. Most commonly, you will see this error code when a method implementation is missing on the server. It can also be generated for unknown compression algorithms or a disagreement as to whether an RPC should be streaming.
Unknown: "unknown"
Unknown error. An example of where this error may be returned is if a Status value received from another address space belongs to an error-space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error.
Encore will generate this error code in the above two mentioned cases.
<!-- symbol-end -->Errornew APIError(
code,
msg,
cause?,
details?): APIError;
Constructs an APIError with the given error code, message, and (optionally) cause.
string
Error
Error.constructor
readonly code: ErrCode
The error code.
readonly optional details?: ErrDetails
withDetails(details): APIError
Constructs a new APIError from the previous one with the provided details
static aborted(msg, cause?): APIError
Constructs an APIError with the Aborted error code.
string
Error
static alreadyExists(msg, cause?): APIError
Constructs an APIError with the AlreadyExists error code.
string
Error
static canceled(msg, cause?): APIError
Constructs an APIError with the Canceled error code.
string
Error
static dataLoss(msg, cause?): APIError
Constructs an APIError with the DataLoss error code.
string
Error
static deadlineExceeded(msg, cause?): APIError
Constructs an APIError with the DeadlineExceeded error code.
string
Error
static failedPrecondition(msg, cause?): APIError
Constructs an APIError with the FailedPrecondition error code.
string
Error
static internal(msg, cause?): APIError
Constructs an APIError with the Internal error code.
string
Error
static invalidArgument(msg, cause?): APIError
Constructs an APIError with the InvalidArgument error code.
string
Error
static notFound(msg, cause?): APIError
Constructs an APIError with the NotFound error code.
string
Error
static outOfRange(msg, cause?): APIError
Constructs an APIError with the OutOfRange error code.
string
Error
static permissionDenied(msg, cause?): APIError
Constructs an APIError with the PermissionDenied error code.
string
Error
static resourceExhausted(msg, cause?): APIError
Constructs an APIError with the ResourceExhausted error code.
string
Error
static unauthenticated(msg, cause?): APIError
Constructs an APIError with the Unauthenticated error code.
string
Error
static unavailable(msg, cause?): APIError
Constructs an APIError with the Unavailable error code.
string
Error
static unimplemented(msg, cause?): APIError
Constructs an APIError with the Unimplemented error code.
string
Error
static unknown(msg, cause?): APIError
Constructs an APIError with the Unknown error code.
string
Error
new Gateway(cfg): Gateway
readonly cfg: GatewayConfig
readonly name: string
new HandlerResponse(payload): HandlerResponse
any
payload: any
The payload returned by the handler when the handler is either a typed handler or stream handler.
get header(): ResponseHeader
header can be used by middlewares to set headers to the response. This only works for typed handler. For raw handlers see MiddlewareRequest.rawResponse.
set status(s): void
Override the http status code for successful requests for typed endpoints.
number
void
new IterableSocket(socket): IterableSocket
Socket
asyncIterator: AsyncGenerator<any, void, unknown>
AsyncGenerator<any, void, unknown>
close(): void
void
recv(): Promise<Record<string, any>>
Promise<Record<string, any>>
send(msg): void
Record<string, any>
void
new IterableStream(stream): IterableStream
Stream
asyncIterator: AsyncGenerator<any, void, unknown>
AsyncGenerator<any, void, unknown>
recv(): Promise<Record<string, any>>
Promise<Record<string, any>>
new MiddlewareRequest(
stream?,
rawReq?,
rawResp?): MiddlewareRequest;
| IterableStream
| IterableSocket
| Sink
get data(): Record<string, any>
data can be used to pass data from middlewares to the handler.
The data will be available via currentRequest()
Record<string, any>
get rawRequest(): RawRequest | undefined
rawRequest is set when the handler is a raw request handler.
The returned value is a Node.js http.IncomingMessage.
RawRequest | undefined
get rawResponse(): RawResponse | undefined
rawResponse is set when the handler is a raw request handler.
The returned value is a Node.js http.ServerResponse.
RawResponse | undefined
get requestMeta(): RequestMeta | undefined
requestMeta is set when the handler is a typed handler or a stream handler. for raw handlers, see rawRequest and rawResponse.
RequestMeta | undefined
get stream():
| IterableStream
| IterableSocket
| Sink
| undefined;
stream is set when the handler is a stream handler.
| IterableStream
| IterableSocket
| Sink
| undefined
Readablenew RawRequest(req, body): RawRequest
Request
BodyReader
stream.Readable.constructor
_headersDistinct: Dict<string[]> | undefined
_rawHeaders: string[] | undefined
_url: string | undefined
complete: boolean
readonly connection: Socket | null
rawTrailers: string[]
readonly socket: Socket | null
trailers: Dict<string>
trailersDistinct: Dict<string[]>
get headers(): IncomingHttpHeaders
IncomingHttpHeaders
get headersDistinct(): Dict<string[]>
Dict<string[]>
get method(): string
string
get rawHeaders(): string[]
string[]
get url(): string
string
set url(value): void
string
void
_read(size): void
number
void
stream.Readable._read
setTimeout(msecs, callback?): this
number
() => void
this
Writablenew RawResponse(req, w): RawResponse
ResponseWriter
stream.Writable.constructor
chunkedEncoding: boolean
readonly connection: Socket | null
finished: boolean
headersSent: boolean
readonly req: RawRequest
sendDate: boolean
shouldKeepAlive: boolean
readonly socket: Socket | null
statusCode: number
statusMessage: string | undefined
strictContentLength: boolean
_final(callback): void
(error?) => void
void
stream.Writable._final
_implicitHeader(): void
void
_write(
chunk,
_encoding,
callback): void;
Buffer
BufferEncoding
(error?) => void
void
stream.Writable._write
_writeHeaderIfNeeded(): void
void
_writev(chunks, callback): void
{
chunk: Buffer;
}[]
(error?) => void
void
stream.Writable._writev
addTrailers(headers): void
OutgoingHttpHeaders | readonly [string, string][]
void
appendHeader(name, value): this
string
string | number | string[]
this
flushHeaders(): void
void
getHeader(name): string | number | string[] | undefined
string
string | number | string[] | undefined
getHeaderNames(): string[]
string[]
getHeaders(): OutgoingHttpHeaders
OutgoingHttpHeaders
hasHeader(name): boolean
string
boolean
removeHeader(name): void
string
void
setHeader(name, value): this
string
string | number | string[]
this
setTimeout(msecs, callback?): this
number
() => void
this
write(chunk, callback?): boolean
The writable.write() method writes some data to the stream, and calls the
supplied callback once the data has been fully handled. If an error
occurs, the callback will be called with the error as its
first argument. The callback is called asynchronously and before 'error' is
emitted.
The return value is true if the internal buffer is less than thehighWaterMark configured when the stream was created after admitting chunk.
If false is returned, further attempts to write data to the stream should
stop until the 'drain' event is emitted.
While a stream is not draining, calls to write() will buffer chunk, and
return false. Once all currently buffered chunks are drained (accepted for
delivery by the operating system), the 'drain' event will be emitted.
Once write() returns false, do not write more chunks
until the 'drain' event is emitted. While calling write() on a stream that
is not draining is allowed, Node.js will buffer all written chunks until
maximum memory usage occurs, at which point it will abort unconditionally.
Even before it aborts, high memory usage will cause poor garbage collector
performance and high RSS (which is not typically released back to the system,
even after the memory is no longer required). Since TCP sockets may never
drain if the remote peer does not read the data, writing a socket that is
not draining may lead to a remotely exploitable vulnerability.
Writing data while the stream is not draining is particularly
problematic for a Transform, because the Transform streams are paused
by default until they are piped or a 'data' or 'readable' event handler
is added.
If the data to be written can be generated or fetched on demand, it is
recommended to encapsulate the logic into a Readable and use pipe. However, if calling write() is preferred, it is
possible to respect backpressure and avoid memory issues using the 'drain' event:
function write(data, cb) {
if (!stream.write(data)) {
stream.once('drain', cb);
} else {
process.nextTick(cb);
}
}
// Wait for cb to be called before doing any other write.
write('hello', () => {
console.log('Write completed, do more writes now.');
});
A Writable stream in object mode will always ignore the encoding argument.
any
Optional data to write. For streams not operating in object mode, chunk must be a string, Buffer or Uint8Array. For object mode streams, chunk may be any
JavaScript value other than null.
(error) => void
Callback for when this chunk of data is flushed.
boolean
false if the stream wishes for the calling code to wait for the 'drain' event to be emitted before continuing to write additional data; otherwise true.
v0.9.4
stream.Writable.write
write(
chunk,
encoding,
callback?): boolean;
any
BufferEncoding
(error) => void
boolean
stream.Writable.write
writeHead(statusCode, headers?): this
number
OutgoingHttpHeaders | OutgoingHttpHeader[]
this
writeHead(
statusCode,
statusMessage?,
headers?): this;
number
string
OutgoingHttpHeaders | OutgoingHttpHeader[]
this
new ResponseHeader(): ResponseHeader
headers: Record<string, string | string[]>
add(key, value): void
add adds a header value to a key, if a previous middleware has already set a value, they will be appended.
string
string | string[]
void
set(key, value): void
set will set a header value for a key, if a previous middleware has already set a value, it will be overridden.
string
string | string[]
void
new Sink(sink): Sink
Sink
close(): void
void
send(msg): void
Record<string, any>
void
new StaticAssets(options): StaticAssets
readonly options: StaticOptions
optional auth?: boolean
Whether or not the request must contain valid authentication credentials. If set to true and the request is not authenticated, Encore returns a 401 Unauthorized error.
Defaults to false if not specified.
optional bodyLimit?: number | null
The maximum body size, in bytes. If the request body exceeds this value, Encore stops request processing and returns an error.
If left unspecified it defaults to a reasonable default (currently 2MiB).
If set to null, the body size is unlimited.
optional expose?: boolean
Whether or not to make this endpoint publicly accessible. If false, the endpoint is only accessible from the internal network.
Defaults to false if not specified.
optional method?: Method | Method[] | "*"
The HTTP method(s) to match for this endpoint. Use "*" to match any method.
optional path?: string
The request path to match for this endpoint.
Use : to define single-segment parameters, e.g. /users/:id.
Use * to match any number of segments, e.g. /files/*path.
If not specified, it defaults to /<service-name>.<endpoint-name>.
optional sensitive?: boolean
When set to true, request information such as payloads and headers will be excluded from traces.
optional tags?: string[]
Tags to filter endpoints when generating clients and in middlewares.
Options when making api calls.
This interface will be extended with additional fields from app's generated code.
optional authHandler?: AuthHandlerBrand
Middleware(req, next): Promise<HandlerResponse>
Promise<HandlerResponse>
optional options?: MiddlewareOptions
optional target?: {
auth?: boolean;
expose?: boolean;
isRaw?: boolean;
isStream?: boolean;
tags?: string[];
};
Configuration for what endpoints that should be targeted by the middleware
optional auth?: boolean
If set, only run middleware on endpoints that either require or not requires auth.
optional expose?: boolean
If set, only run middleware on endpoints that are either exposed or not exposed.
optional isRaw?: boolean
If set, only run middleware on endpoints that are raw endpoints.
optional isStream?: boolean
If set, only run middleware on endpoints that are stream endpoints.
optional tags?: string[]
If set, only run middleware on endpoints that have specific tags. These tags are evaluated with OR, meaning the middleware applies to an API if the API has at least one of those tags.
optional auth?: boolean
Whether or not the request must contain valid authentication credentials. If set to true and the request is not authenticated, Encore returns a 401 Unauthorized error.
Defaults to false if not specified.
dir: string
The relative path to the directory containing the static files to serve.
The provided path must be a subdirectory from the calling file's directory.
optional expose?: boolean
Whether or not to make this endpoint publicly accessible. If false, the endpoint is only accessible from the internal network.
Defaults to false if not specified.
optional headers?: Record<string, string | string[]>
Custom HTTP headers to apply to all static files served.
headers: {
"Cache-Control": "public, max-age=3600",
"X-Content-Type-Options": "nosniff",
}
optional notFound?: string
Path to the file to serve when the requested file is not found. The path must be a relative path to within the calling file's directory.
optional notFoundStatus?: number
Http Status code used when serving notFound fallback. Defaults to 404.
optional path?: string
The request path to match for this endpoint.
Use : to define single-segment parameters, e.g. /users/:id.
Use * to match any number of segments, e.g. /files/*path.
If not specified, it defaults to /<service-name>.<endpoint-name>.
AsyncIterable<Request>Request
recv: () => Promise<Request>
Promise<Request>
optional auth?: boolean
Whether or not the request must contain valid authentication credentials. If set to true and the request is not authenticated, Encore returns a 401 Unauthorized error.
Defaults to false if not specified.
optional expose?: boolean
Whether or not to make this endpoint publicly accessible. If false, the endpoint is only accessible from the internal network.
Defaults to false if not specified.
optional path?: string
The request path to match for this endpoint.
Use : to define single-segment parameters, e.g. /users/:id.
Use * to match any number of segments, e.g. /files/*path.
If not specified, it defaults to /<service-name>.<endpoint-name>.
optional sensitive?: boolean
When set to true, request information such as payloads and headers will be excluded from traces.
optional tags?: string[]
Tags to filter endpoints when generating clients and in middlewares.
Response
close: () => Promise<void>
Promise<void>
send: (msg) => Promise<void>
Response
Promise<void>
StreamOut<Request>Request
Response
close: () => Promise<void>
Promise<void>
response: () => Promise<Response>
Promise<Response>
send: (msg) => Promise<void>
Request
Promise<void>
type Cookie<TypeOrName, Name> = TypeOrName extends string ? CookieWithOptions<string> : CookieWithOptions<TypeOrName>
TypeOrName extends string | number | boolean | Date = string
Name extends string = ""
type CookieWithOptions<T> = {
domain?: string;
expires?: Date;
httpOnly?: boolean;
maxAge?: number;
partitioned?: boolean;
path?: string;
sameSite?: "Strict" | "Lax" | "None";
secure?: boolean;
value: T;
};
T
optional domain?: string
optional expires?: Date
optional httpOnly?: boolean
optional maxAge?: number
optional partitioned?: boolean
optional path?: string
optional sameSite?: "Strict" | "Lax" | "None"
optional secure?: boolean
value: T
type ErrDetails = Record<string, any>
Additional structured error details that can be attached to an APIError.
type Header<TypeOrName, Name> = TypeOrName extends string ? string : TypeOrName
TypeOrName extends string | number | boolean | Date = string
Name extends string = ""
type HttpStatus = typeof HttpStatusValues[keyof typeof HttpStatusValues]
The union of all HTTP status code numeric values.
type Method =
| "GET"
| "POST"
| "PUT"
| "DELETE"
| "PATCH"
| "HEAD"
| "OPTIONS"
| "TRACE"
| "CONNECT";
type MiddlewareFn = (req, next) => Promise<HandlerResponse>
Promise<HandlerResponse>
type Next = (req) => Promise<HandlerResponse>
Promise<HandlerResponse>
type Query<TypeOrName, Name> = TypeOrName extends string ? string : TypeOrName
TypeOrName extends string | string[] | number | number[] | boolean | boolean[] | Date | Date[] = string
Name extends string = ""
type RawHandler = (req, resp) => void
IncomingMessage
ServerResponse
void
type StreamInHandlerFn<HandshakeData, Request, Response> = HandshakeData extends void ? (stream) => Promise<Response> : (data, stream) => Promise<Response>
HandshakeData
Request
Response
type StreamInOut<Request, Response> = StreamIn<Request> & StreamOut<Response>
Request
Response
type StreamInOutHandlerFn<HandshakeData, Request, Response> = HandshakeData extends void ? (stream) => Promise<void> : (data, stream) => Promise<void>
HandshakeData
Request
Response
type StreamOutHandlerFn<HandshakeData, Response> = HandshakeData extends void ? (stream) => Promise<void> : (data, stream) => Promise<void>
HandshakeData
Response
const HttpStatus: {
Accepted: 202;
AlreadyReported: 208;
BadGateway: 502;
BadRequest: 400;
Conflict: 409;
Continue: 100;
Created: 201;
EarlyHints: 103;
ExpectationFailed: 417;
FailedDependency: 424;
Forbidden: 403;
Found: 302;
GatewayTimeout: 504;
Gone: 410;
HTTPVersionNotSupported: 505;
ImATeapot: 418;
IMUsed: 226;
InsufficientStorage: 507;
InternalServerError: 500;
LengthRequired: 411;
Locked: 423;
LoopDetected: 508;
MethodNotAllowed: 405;
MisdirectedRequest: 421;
MovedPermanently: 301;
MultipleChoices: 300;
MultiStatus: 207;
NetworkAuthenticationRequired: 511;
NoContent: 204;
NonAuthoritativeInformation: 203;
NotAcceptable: 406;
NotExtended: 510;
NotFound: 404;
NotImplemented: 501;
NotModified: 304;
OK: 200;
PartialContent: 206;
PayloadTooLarge: 413;
PaymentRequired: 402;
PermanentRedirect: 308;
PreconditionFailed: 412;
PreconditionRequired: 428;
Processing: 102;
ProxyAuthenticationRequired: 407;
RangeNotSatisfiable: 416;
RequestHeaderFieldsTooLarge: 431;
RequestTimeout: 408;
ResetContent: 205;
SeeOther: 303;
ServiceUnavailable: 503;
SwitchingProtocols: 101;
SwitchProxy: 306;
TemporaryRedirect: 307;
TooEarly: 425;
TooManyRequests: 429;
Unauthorized: 401;
UnavailableForLegalReasons: 451;
UnprocessableEntity: 422;
UnsupportedMediaType: 415;
UpgradeRequired: 426;
URITooLong: 414;
UseProxy: 305;
VariantAlsoNegotiates: 506;
} = HttpStatusValues;
A map of HTTP status code names to their numeric values.
readonly Accepted: 202 = 202
readonly AlreadyReported: 208 = 208
readonly BadGateway: 502 = 502
readonly BadRequest: 400 = 400
readonly Conflict: 409 = 409
readonly Continue: 100 = 100
readonly Created: 201 = 201
readonly EarlyHints: 103 = 103
readonly ExpectationFailed: 417 = 417
readonly FailedDependency: 424 = 424
readonly Forbidden: 403 = 403
readonly Found: 302 = 302
readonly GatewayTimeout: 504 = 504
readonly Gone: 410 = 410
readonly HTTPVersionNotSupported: 505 = 505
readonly ImATeapot: 418 = 418
readonly IMUsed: 226 = 226
readonly InsufficientStorage: 507 = 507
readonly InternalServerError: 500 = 500
readonly LengthRequired: 411 = 411
readonly Locked: 423 = 423
readonly LoopDetected: 508 = 508
readonly MethodNotAllowed: 405 = 405
readonly MisdirectedRequest: 421 = 421
readonly MovedPermanently: 301 = 301
readonly MultipleChoices: 300 = 300
readonly MultiStatus: 207 = 207
readonly NetworkAuthenticationRequired: 511 = 511
readonly NoContent: 204 = 204
readonly NonAuthoritativeInformation: 203 = 203
readonly NotAcceptable: 406 = 406
readonly NotExtended: 510 = 510
readonly NotFound: 404 = 404
readonly NotImplemented: 501 = 501
readonly NotModified: 304 = 304
readonly OK: 200 = 200
readonly PartialContent: 206 = 206
readonly PayloadTooLarge: 413 = 413
readonly PaymentRequired: 402 = 402
readonly PermanentRedirect: 308 = 308
readonly PreconditionFailed: 412 = 412
readonly PreconditionRequired: 428 = 428
readonly Processing: 102 = 102
readonly ProxyAuthenticationRequired: 407 = 407
readonly RangeNotSatisfiable: 416 = 416
readonly RequestHeaderFieldsTooLarge: 431 = 431
readonly RequestTimeout: 408 = 408
readonly ResetContent: 205 = 205
readonly SeeOther: 303 = 303
readonly ServiceUnavailable: 503 = 503
readonly SwitchingProtocols: 101 = 101
readonly SwitchProxy: 306 = 306
readonly TemporaryRedirect: 307 = 307
readonly TooEarly: 425 = 425
readonly TooManyRequests: 429 = 429
readonly Unauthorized: 401 = 401
readonly UnavailableForLegalReasons: 451 = 451
readonly UnprocessableEntity: 422 = 422
readonly UnsupportedMediaType: 415 = 415
readonly UpgradeRequired: 426 = 426
readonly URITooLong: 414 = 414
readonly UseProxy: 305 = 305
readonly VariantAlsoNegotiates: 506 = 506
const HttpStatusValues: {
Accepted: 202;
AlreadyReported: 208;
BadGateway: 502;
BadRequest: 400;
Conflict: 409;
Continue: 100;
Created: 201;
EarlyHints: 103;
ExpectationFailed: 417;
FailedDependency: 424;
Forbidden: 403;
Found: 302;
GatewayTimeout: 504;
Gone: 410;
HTTPVersionNotSupported: 505;
ImATeapot: 418;
IMUsed: 226;
InsufficientStorage: 507;
InternalServerError: 500;
LengthRequired: 411;
Locked: 423;
LoopDetected: 508;
MethodNotAllowed: 405;
MisdirectedRequest: 421;
MovedPermanently: 301;
MultipleChoices: 300;
MultiStatus: 207;
NetworkAuthenticationRequired: 511;
NoContent: 204;
NonAuthoritativeInformation: 203;
NotAcceptable: 406;
NotExtended: 510;
NotFound: 404;
NotImplemented: 501;
NotModified: 304;
OK: 200;
PartialContent: 206;
PayloadTooLarge: 413;
PaymentRequired: 402;
PermanentRedirect: 308;
PreconditionFailed: 412;
PreconditionRequired: 428;
Processing: 102;
ProxyAuthenticationRequired: 407;
RangeNotSatisfiable: 416;
RequestHeaderFieldsTooLarge: 431;
RequestTimeout: 408;
ResetContent: 205;
SeeOther: 303;
ServiceUnavailable: 503;
SwitchingProtocols: 101;
SwitchProxy: 306;
TemporaryRedirect: 307;
TooEarly: 425;
TooManyRequests: 429;
Unauthorized: 401;
UnavailableForLegalReasons: 451;
UnprocessableEntity: 422;
UnsupportedMediaType: 415;
UpgradeRequired: 426;
URITooLong: 414;
UseProxy: 305;
VariantAlsoNegotiates: 506;
};
readonly Accepted: 202 = 202
readonly AlreadyReported: 208 = 208
readonly BadGateway: 502 = 502
readonly BadRequest: 400 = 400
readonly Conflict: 409 = 409
readonly Continue: 100 = 100
readonly Created: 201 = 201
readonly EarlyHints: 103 = 103
readonly ExpectationFailed: 417 = 417
readonly FailedDependency: 424 = 424
readonly Forbidden: 403 = 403
readonly Found: 302 = 302
readonly GatewayTimeout: 504 = 504
readonly Gone: 410 = 410
readonly HTTPVersionNotSupported: 505 = 505
readonly ImATeapot: 418 = 418
readonly IMUsed: 226 = 226
readonly InsufficientStorage: 507 = 507
readonly InternalServerError: 500 = 500
readonly LengthRequired: 411 = 411
readonly Locked: 423 = 423
readonly LoopDetected: 508 = 508
readonly MethodNotAllowed: 405 = 405
readonly MisdirectedRequest: 421 = 421
readonly MovedPermanently: 301 = 301
readonly MultipleChoices: 300 = 300
readonly MultiStatus: 207 = 207
readonly NetworkAuthenticationRequired: 511 = 511
readonly NoContent: 204 = 204
readonly NonAuthoritativeInformation: 203 = 203
readonly NotAcceptable: 406 = 406
readonly NotExtended: 510 = 510
readonly NotFound: 404 = 404
readonly NotImplemented: 501 = 501
readonly NotModified: 304 = 304
readonly OK: 200 = 200
readonly PartialContent: 206 = 206
readonly PayloadTooLarge: 413 = 413
readonly PaymentRequired: 402 = 402
readonly PermanentRedirect: 308 = 308
readonly PreconditionFailed: 412 = 412
readonly PreconditionRequired: 428 = 428
readonly Processing: 102 = 102
readonly ProxyAuthenticationRequired: 407 = 407
readonly RangeNotSatisfiable: 416 = 416
readonly RequestHeaderFieldsTooLarge: 431 = 431
readonly RequestTimeout: 408 = 408
readonly ResetContent: 205 = 205
readonly SeeOther: 303 = 303
readonly ServiceUnavailable: 503 = 503
readonly SwitchingProtocols: 101 = 101
readonly SwitchProxy: 306 = 306
readonly TemporaryRedirect: 307 = 307
readonly TooEarly: 425 = 425
readonly TooManyRequests: 429 = 429
readonly Unauthorized: 401 = 401
readonly UnavailableForLegalReasons: 451 = 451
readonly UnprocessableEntity: 422 = 422
readonly UnsupportedMediaType: 415 = 415
readonly UpgradeRequired: 426 = 426
readonly URITooLong: 414 = 414
readonly UseProxy: 305 = 305
readonly VariantAlsoNegotiates: 506 = 506
function api<Params, Response>(options, fn): HandlerFn<Params, Response>
Params extends void | object = void
Response extends void | object = void
(params) => Promise<Response>
HandlerFn<Params, Response>
function api<Params, Response>(options, fn): HandlerFn<Params, Response>
Params extends void | object = void
Response extends void | object = void
(params) => Response
HandlerFn<Params, Response>
function middleware(m): Middleware
function middleware(options, fn): Middleware