summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/starlarkmw/example/caddy.json
blob: 66f9f2c8ecf51c66a7609fdd588b4a2064aebf97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
	"apps": {
		"http": {
			"servers": {
				"MY_SERVER": {
					"listen": [":3001"],
					"routes": [
						{
							"handle": {
								"handler": "starlark",
								"script": "def setup(r):\n\t# create some middlewares specific to this request\n\ttemplates = loadModule('http.handlers.templates', {'include_root': './includes'})\n\tmidChain = execute([templates])\n\ndef serveHTTP (rw, r):\n\trw.Write('Hello world, from Starlark!')\n"
							}
						}
					]
				}
			}
		}
	}
}