Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Web Server JSON Route
Respond to incoming HTTP GET request with a JSON structured payload.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Web & Network). Copy the parameterized template or run the self-contained example.
- 1Category: Web & Network
- 2Attribution: Otter Web Runtime Contract (WEB-001)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
site is a web server
port is ${portNumber}
host is "127.0.0.1"
.
when site receives GET at "${path}"
payload has
status is "ok"
.
respond with payload as json
.
site is a web server
port is 18090
host is "127.0.0.1"
.
when site receives GET at "/health"
payload has
status is "healthy"
uptime is "active"
.
respond with payload as json
.
Installation & Usage
otter snippet inspect web-http-json-response
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.