HttpServer
Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.
Up and coming
Let other programs on this computer send your running program requests.
HttpService:ServeAsync(options) gives one, a child of HttpService, listening on this computer only, at the first free port from the one asked for. Route answers a method and a path; with a path alone it gives an HttpRoute. Requests and responses work as in PageService, which serves your program's own pages.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| Url | string | ||
| Port | number | The port it listens on: the first free one from the Port that ServeAsync asked for. | |
| Advertise | string? | A name under which the port is written to a file in the temp folder, so a script can find it; removed at Stop. |
Methods
| Name | Arguments | Returns | Description |
|---|---|---|---|
| Route | (method: string, path: string, handler: (request: Request) -> Response | string) | () | Answers requests for a method and path with the handler; with a path alone it gives an HttpRoute to nest routes under. |
| Route | (path: string, handler: ((request: Request) -> Response | string)?) | HttpRoute | Answers requests for a method and path with the handler; with a path alone it gives an HttpRoute to nest routes under. |
| Stop | () | () |
Events
| Name | Passes | Description |
|---|---|---|
| RequestReceived | (Request) | Fires with every request, after it was answered. |
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
