Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "floof"

Index

Type aliases

Adapted

Adapted: Promise<any> | any

An object that's been typecasted via a body parser or type adapter. May or may not be a promise.

AdapterType

AdapterType: "str" | "int" | "float" | "bool" | string

A short string identifier for a type adapter type.

BodyParser

BodyParser: function

A function that consumes an IncomingMessage, parses the message body, and produces the result. May or may not be async.

Type declaration

    • Parameters

      • req: IncomingMessage

      Returns Adapted

EndpointPath

EndpointPath: string

A string of the format "/foo/bar", where the forwards slashes delimit a path from the root of a web service. You can also include parameters using colon-prefixed path elements, as in "/foo/bar/:param". Furthermore, you can define types for each parameter, as in "foo/bar/:param|int". They'll be automatically parsed and a 400 will be thrown if an invalid request is made.

FloofResponse

FloofResponse: Stoof | string | any

A response to a request. Preferrably a Stoof or a string, but floof will try to convert any other type to an acceptable one.

HttpVerb

HttpVerb: "GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE"

An HTTP verb (or method or action or whatever you want to call it).

ParserType

ParserType: "json" | "str" | "buf" | "form" | string

A short string identifier for a body parser type.

RedirectCode

RedirectCode: 301 | 302 | 303 | 305 | 307

A valid HTTP status code for a redirect.

RenderContext

RenderContext: object

An object mapping arbitrary string keys to arbitrary values for use in rendering a template.

Type declaration

  • [key: string]: any

TypeAdapter

TypeAdapter: function

A function that consumes a string, parses is at some type, and produces the result. May or may not be async.

Type declaration

Functions

redirect

  • Generates a response that redirects to a URL.

    Parameters

    • url: string

      The URL to redirect to.

    • Optional code: RedirectCode

      The HTTP status code to redirect with. Defaults to 302.

    Returns Stoof

    This Stoof instance, for the sake of chaining.

Generated using TypeDoc