Endpoint

Source
import { Endpoint } from "@prestojs/rest";
Endpoint<ReturnT = any>

API

Constructor

new Endpoint(urlPattern,?options)

Arguments:

ArgumentTypeDescription
*urlPatternUrlPattern
options
An object with the properties below
options.baseUrlstring
options.decodeBody
options.getMiddleware
options.middleware(|)[]
options.resolveUrl
...any
Any properties from ExecuteInitOptions

Methods

decodeBody(res)

Component Props:

PropTypeDescription
*resResponse
execute(?options)

Arguments:

ArgumentTypeDescription
options
An object with the properties below
...any
Any properties from ExecuteInitOptions
...any
Any properties from UrlResolveOptions
Returns:Promise
fetch(url,requestInit)

Arguments:

ArgumentTypeDescription
*urlstring
*requestInitundefined|RequestInit
Returns:Promise
prepare(?options)

Arguments:

ArgumentTypeDescription
options
An object with the properties below
...any
Any properties from ExecuteInitOptions
...any
Any properties from UrlResolveOptions
resolveUrl(urlPattern)

Component Props:

PropTypeDescription
*urlPatternUrlPattern

Properties

baseUrl

Source
string

middleware

Source
(|)[]

requestInit

Source
ExecuteInitOptions

Static Properties

defaultConfig

Source
An object with these properties:
PropertyTypeDescription
*baseUrlstring
*getMiddleware
*middleware(|)[]
*requestInitRequestInit