Web Apps
17 nodes
On this page 17
Create Web App
FunctionA new web app with no endpoints yet.
CreateWebApp(name: Text) -> Web App
WebApp CreateWebApp(string name = "Web App")
Parameters
| name | type | default | description |
|---|---|---|---|
| name | Text | Web App | What the app is called, in its OpenAPI document. |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Delete
FunctionAnswers DELETE requests on a route with a function.
MapDelete -> Web App
app: Web App
pattern: Text
handler: DelegateWebApp MapDelete(WebApp app, string pattern, Delegate handler)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| pattern | Text | — | |
| handler | Delegate | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Fallback
FunctionAnswers every request no endpoint or file answered - a 404 page, or a single-page app's index.
MapFallback(app: Web App, handler: Delegate) -> Web App
WebApp MapFallback(WebApp app, Delegate handler)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| handler | Delegate | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Get
FunctionAnswers GET requests on a route with a function: /todos/{id} fills an input named Id.
MapGet -> Web App
app: Web App
pattern: Text
handler: DelegateWebApp MapGet(WebApp app, string pattern, Delegate handler)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| pattern | Text | — | The route, with any values in braces; ASP.NET Core's constraints work too ({id:int}). |
| handler | Delegate | — | The function that answers - graph:Name for one of this document's graphs. Its inputs are filled from the request by name; what it returns is the answer. |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Group
FunctionPuts another app's endpoints under a prefix - /api - as ASP.NET Core's route groups do: build the group's endpoints in an app of their own (and require a key on them there, if they need one), then map the group.
MapGroup(app: Web App, prefix: Text, group: Web App) -> Web App
WebApp MapGroup(WebApp app, string prefix, WebApp group)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| prefix | Text | — | What every route of the group starts with. |
| group | Web App | — | The app holding the group's endpoints. |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Methods
FunctionAnswers requests of several methods - HEAD, OPTIONS or any other - on a route with one function.
MapMethods -> Web App
app: Web App
methods: Text Array
pattern: Text
handler: DelegateWebApp MapMethods(
WebApp app,
string[] methods,
string pattern,
Delegate handler)Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| methods | Text Array | — | The methods, such as GET and HEAD. |
| pattern | Text | — | |
| handler | Delegate | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Patch
FunctionAnswers PATCH requests on a route with a function.
MapPatch -> Web App
app: Web App
pattern: Text
handler: DelegateWebApp MapPatch(WebApp app, string pattern, Delegate handler)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| pattern | Text | — | |
| handler | Delegate | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Post
FunctionAnswers POST requests on a route with a function; a record or class input is read from the JSON body, simple inputs from its fields or a form.
MapPost -> Web App
app: Web App
pattern: Text
handler: DelegateWebApp MapPost(WebApp app, string pattern, Delegate handler)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| pattern | Text | — | |
| handler | Delegate | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Map Put
FunctionAnswers PUT requests on a route with a function.
MapPut -> Web App
app: Web App
pattern: Text
handler: DelegateWebApp MapPut(WebApp app, string pattern, Delegate handler)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| pattern | Text | — | |
| handler | Delegate | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Require Api Key
FunctionRequires a key on every endpoint mapped so far: a request without the header, or with another key, is answered 401. Map the endpoints first; on a group, require it in the group's own app before mapping the group.
RequireApiKey(app: Web App, key: Text, header: Text) -> Web App
WebApp RequireApiKey(
WebApp app,
string key,
string header = "X-Api-Key")Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| key | Text | — | The key the header must carry. |
| header | Text | X-Api-Key | The header it comes in. |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Run
FunctionRuns the app until the program ends, or the run it belongs to is stopped - the last step of a program whose job is to serve.
Run(app: Web App, URL: Text)
void Run(WebApp app, string url = "http://localhost:5000")
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| URL | Text | http://localhost:5000 | Where it answers: http://localhost:5000 for this machine, http://0.0.0.0:5000 for the network. A host that runs the document - the Divooka platform, an assistant testing it - answers where it says instead. |
Remarks
Round 26: a run's Stop shuts the app down and Run returns, through Contracts.DivookaRunCancellation, which the editor sets around a run; Run used to wait for the process to be told to end, which inside the editor never came.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Start
FunctionStarts the app in the background and returns at once with where it answers - for a program that serves as one step, calls itself, and stops; it stops on its own after Max Seconds.
Start -> Running Web App
app: Web App
URL: Text
maxSeconds: NumberRunningWebApp Start(
WebApp app,
string url = "http://127.0.0.1:0",
double maxSeconds = 60)Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| URL | Text | http://127.0.0.1:0 | Where it answers; port 0 takes a free one, which the result's Address says. |
| maxSeconds | Number | 60 | The longest it runs before stopping on its own. |
Returns
| Running | Running Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Stop
FunctionStops an app Start started and releases its port; stopping one that has stopped does nothing.
Stop(running: Running Web App)
void Stop(RunningWebApp running)
Parameters
| name | type | default | description |
|---|---|---|---|
| running | Running Web App | — |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Use Cors
FunctionLets pages from other sites call the app from a browser (CORS): the origins allowed, or * for any.
UseCors(app: Web App, origins: Text Array) -> Web App
WebApp UseCors(WebApp app, string[] origins)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| origins | Text Array | — | Origins such as https://example.com, or *. |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Use Open Api
FunctionDescribes the app's endpoints as an OpenAPI 3 document at a path - what Swagger UI, Postman and code generators read - from its routes and its handlers' inputs.
UseOpenApi -> Web App
app: Web App
title: Text
version: Text
path: TextWebApp UseOpenApi(
WebApp app,
string title = "",
string version = "1.0",
string path = "/openapi.json")Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| title | Text | — | |
| version | Text | 1.0 | |
| path | Text | /openapi.json |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Use Request Logging
FunctionPrints a line for every request - method, path, status and time - to the program's output.
UseRequestLogging(app: Web App) -> Web App
WebApp UseRequestLogging(WebApp app)
Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications
Use Static Files
FunctionServes the files of a folder - pages, scripts, pictures - with index.html for a folder's own address.
UseStaticFiles -> Web App
app: Web App
folder: Text
requestPath: Text
defaultFiles: TruthWebApp UseStaticFiles(
WebApp app,
string folder = "wwwroot",
string requestPath = "",
bool defaultFiles = true)Parameters
| name | type | default | description |
|---|---|---|---|
| app | Web App | — | |
| folder | Text | wwwroot | The folder, relative to the document (wwwroot, site). |
| requestPath | Text | — | Where under the app it is served; empty for the root. |
| defaultFiles | Truth | True | Whether a folder's address serves its index.html. |
Returns
| App | Web App |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Web Apps
- Package
- Web Applications