Early developmentPre-1.0: syntax may change.Release historyGitHub

Application types

REST applications

Define HTTP endpoints with @Route and execute their steps in run:. REST apps can also host Rune-Web pages, static files, and WebSocket hooks.

#!RUNE
@App
name = Greeting API
type = REST
port = 3000

@Route/GET /hello
run:
    greeting = { message: "Hello from Rune" }
    respond 200 greeting

Reading the syntax

  • @App selects type = REST. port sets the listening port; the CLI can override it with --port.
  • @Route/GET /hello names a method and path. Use POST, PUT, PATCH, or DELETE for other endpoints.
  • run: contains ordered steps. respond 200 sends an HTTP status and payload; @Schema and validate can check incoming data.

Run locally

Save this source as rest.rune, start the server, then request /hello.

vectrune rest.rune
curl http://127.0.0.1:3000/hello

Try the example below in the browser, or use the GET, POST, and validation tutorials in the sidebar.

Interactive

Read, edit, run

Apply the code to prepare this browser example, then send a request. Document and AST inspection are available under the advanced controls.

i18n.Sandbox.code

Inspect document or AST

Output

Apply code to prepare the example, then send a request.

This playground simulates requests in your browser. Apply the code, then choose an endpoint and press Send Request.

Built entirely with Rune-Web