@gasstack/http / Exports
- Application
- ApplicationBuilder
- ApplicationBuilderFn
- HttpOutput
- HttpRequest
- HttpResponse
- HttpResponseHelper
- MiddlewareFn
- PathParams
- RouteHandler
- ViewParams
Renames and re-exports appBuilder
Ƭ Application: (request
: HttpRequest
) => HttpOutput
▸ (request
): HttpOutput
Name | Type |
---|---|
request |
HttpRequest |
Ƭ ApplicationBuilder: Object
Name | Type |
---|---|
all |
(match : string , fn : RouteHandler ) => ApplicationBuilder |
get |
(match : string , fn : RouteHandler ) => ApplicationBuilder |
post |
(match : string , fn : RouteHandler ) => ApplicationBuilder |
use |
(fn : MiddlewareFn ) => ApplicationBuilder |
Ƭ ApplicationBuilderFn: (builder
: ApplicationBuilder
) => void
▸ (builder
): void
Name | Type |
---|---|
builder |
ApplicationBuilder |
void
Ƭ HttpOutput: GoogleAppsScript.HTML.HtmlOutput
| GoogleAppsScript.Content.TextOutput
Ƭ HttpRequest: GoogleAppsScript.Events.DoGet
| GoogleAppsScript.Events.DoPost
& { pathParams?
: PathParams
}
Ƭ HttpResponse: Object
Name | Type |
---|---|
error? |
string | null |
result |
HttpOutput | null |
Ƭ HttpResponseHelper: Object
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 |
Ƭ MiddlewareFn: (request
: HttpRequest
, response
: HttpResponse
) => void
▸ (request
, response
): void
Name | Type |
---|---|
request |
HttpRequest |
response |
HttpResponse |
void
Ƭ PathParams: Object
▪ [key: string
]: string
Ƭ RouteHandler: MiddlewareFn
| MiddlewareFn
[]
Ƭ ViewParams: Object
▪ [key: string
]: any
▸ appBuilder(builder
): Application
Factory function to configure an http application in an Express.js-like fashion.
Name | Type |
---|---|
builder |
ApplicationBuilderFn |
Http Application.
▸ 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.
Name | Type | Description |
---|---|---|
app |
Application |
Http App to be installed. |
void
▸ respond(response
): HttpResponseHelper
Wraps a response object in an helper to produce the deisred response.
Name | Type | Description |
---|---|---|
response |
HttpResponse |
Return Helper handler to produce an http response. |
Http response helper/builder object.