Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vibe.d;
- shared static this()
- {
- auto settings = new HTTPServerSettings;
- settings.port = 8080;
- settings.bindAddresses = ["::1", "127.0.0.1"];
- listenHTTP(settings, &hello);
- listenTCP(7000, handle_conn);
- logInfo("Please open http://127.0.0.1:8080/ in your browser.");
- }
- void hello(HTTPServerRequest req, HTTPServerResponse res)
- {
- res.writeBody("Hello, World!");
- }
- void handle_conn(TCPConnection stream) {
- stream.write(stream);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement