File: app.d

package info (click to toggle)
diet-ng 1.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 336 kB
  • sloc: sh: 11; makefile: 7
file content (21 lines) | stat: -rw-r--r-- 471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import diet.html;
import vibe.core.core;
import vibe.http.server;
import vibe.stream.wrapper;

void render(scope HTTPServerRequest req, scope HTTPServerResponse res)
{
	auto dst = streamOutputRange(res.bodyWriter);
	int iterations = 10;
	dst.compileHTMLDietFile!("index.dt", iterations);
}

void main()
{
	auto settings = new HTTPServerSettings;
	settings.bindAddresses = ["::1", "127.0.0.1"];
	settings.port = 8080;
	listenHTTP(settings, &render);

	runApplication();
}