Quick
A namespace providing quick methods for creating Edge responses with commonly used status codes.
The Quick
class is a wrapper around the EdgeResponse
that is a wrapper on the Response
class to make it easier to use.
Reference: MDN Web API Reference - Response
Installation
Simple Usage
API Reference
Quick
A namespace providing quick methods for creating Edge responses with commonly used status codes.
Constants
STATUS_CODES
: An object containing various HTTP status codes.
Methods
ok()
: Quickly end the response with status code 200.created()
: Quickly end the response with status code 201.accepted()
: Quickly end the response with status code 202.noContent()
: Quickly end the response with status code 204.resetContent()
: Quickly end the response with status code 205.partialContent()
: Quickly end the response with status code 206.- ... (other methods for different status codes)
end()
: Quickly end the response with status code 200.send(body: unknown)
: Quickly send a response with status code 200 and custom body.text(body: string)
: Quickly send a text response with status code 200.json(body: unknown)
: Quickly send a JSON response with status code 200.code(status: number)
: Send & end a response with the specified status code.status(status: number)
: Set the status code of the response.
Links
The Quick
class is in the same file as the EdgeResponse
class, so you can find the source code here: