Skip to content

Latest commit

 

History

History
294 lines (168 loc) · 6.74 KB

modules.md

File metadata and controls

294 lines (168 loc) · 6.74 KB

@gasstack/http / Exports

@gasstack/http

Table of contents

References

Type Aliases

Functions

References

default

Renames and re-exports appBuilder

Type Aliases

Application

Ƭ Application: (request: HttpRequest) => HttpOutput

Type declaration

▸ (request): HttpOutput

Parameters
Name Type
request HttpRequest
Returns

HttpOutput

Defined in

src/types.ts:27


ApplicationBuilder

Ƭ ApplicationBuilder: Object

Type declaration

Name Type
all (match: string, fn: RouteHandler) => ApplicationBuilder
get (match: string, fn: RouteHandler) => ApplicationBuilder
post (match: string, fn: RouteHandler) => ApplicationBuilder
use (fn: MiddlewareFn) => ApplicationBuilder

Defined in

src/types.ts:20


ApplicationBuilderFn

Ƭ ApplicationBuilderFn: (builder: ApplicationBuilder) => void

Type declaration

▸ (builder): void

Parameters
Name Type
builder ApplicationBuilder
Returns

void

Defined in

src/types.ts:29


HttpOutput

Ƭ HttpOutput: GoogleAppsScript.HTML.HtmlOutput | GoogleAppsScript.Content.TextOutput

Defined in

src/types.ts:6


HttpRequest

Ƭ HttpRequest: GoogleAppsScript.Events.DoGet | GoogleAppsScript.Events.DoPost & { pathParams?: PathParams }

Defined in

src/types.ts:2


HttpResponse

Ƭ HttpResponse: Object

Type declaration

Name Type
error? string | null
result HttpOutput | null

Defined in

src/types.ts:9


HttpResponseHelper

Ƭ HttpResponseHelper: Object

Type declaration

Name Type
download (content: string, filename: string) => void
error (error: string) => void
json (content: any) => void
ok () => void
text (content: string) => void
view (path: string, params: ViewParams) => void

Defined in

src/app.ts:148


MiddlewareFn

Ƭ MiddlewareFn: (request: HttpRequest, response: HttpResponse) => void

Type declaration

▸ (request, response): void

Parameters
Name Type
request HttpRequest
response HttpResponse
Returns

void

Defined in

src/types.ts:14


PathParams

Ƭ PathParams: Object

Index signature

▪ [key: string]: string

Defined in

src/types.ts:1


RouteHandler

Ƭ RouteHandler: MiddlewareFn | MiddlewareFn[]

Defined in

src/types.ts:18


ViewParams

Ƭ ViewParams: Object

Index signature

▪ [key: string]: any

Defined in

src/app.ts:147

Functions

appBuilder

appBuilder(builder): Application

Factory function to configure an http application in an Express.js-like fashion.

Parameters

Name Type
builder ApplicationBuilderFn

Returns

Application

Http Application.

Defined in

src/app.ts:198


installHttpApp

installHttpApp(app): void

Install an app in the Google App Script global scope. It creates both the doGet and doPost handler. If a handler already exists, the orgiginal handler is wrapped and executed when the http app returns an error.

Parameters

Name Type Description
app Application Http App to be installed.

Returns

void

Defined in

index.ts:12


respond

respond(response): HttpResponseHelper

Wraps a response object in an helper to produce the deisred response.

Parameters

Name Type Description
response HttpResponse Return Helper handler to produce an http response.

Returns

HttpResponseHelper

Http response helper/builder object.

Defined in

src/app.ts:162