Endpoint

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

API

Constructor

new Endpoint(urlPattern,?options)
Params:
ParameterTypeDescription
*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)
Params:
ParameterTypeDescription
*resResponse
Returns:any
execute(?options)
Params:
ParameterTypeDescription
options
An object with the properties below
...any
Any properties from ExecuteInitOptions
...any
Any properties from UrlResolveOptions
Returns:Promise
fetch(url,requestInit)
Params:
ParameterTypeDescription
*urlstring
*requestInitundefined|RequestInit
Returns:Promise
prepare(?options)
Params:
ParameterTypeDescription
options
An object with the properties below
...any
Any properties from ExecuteInitOptions
...any
Any properties from UrlResolveOptions
resolveUrl(urlPattern,urlArgs,query,baseUrl)
Params:
ParameterTypeDescription
*urlPatternUrlPattern
*urlArgsRecord
*queryundefined|Query
*baseUrlstring
Returns:string

Properties

baseUrl

Source
string

middleware

Source
(|)[]

requestInit

Source
ExecuteInitOptions

Static Properties

defaultConfig

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