/* handlers/echo.du -- Echo back request data as JSON */ ctx = context() req = ctx.request() res = ctx.response() // Parse incoming JSON if present data = nil if req.body then try data = parse_json(req.body) catch (err) res.json({error = "Invalid JSON: " + err}) end end // Echo response response = { method = req.method, path = req.path, headers = req.headers, data = data, timestamp = now() } res.json(response)