app.d 424 B

12345678910111213141516171819202122
  1. import vibe.vibe;
  2. void main()
  3. {
  4. auto settings = new HTTPServerSettings;
  5. settings.port = 8080;
  6. settings.bindAddresses = ["::1", "127.0.0.1"];
  7. auto listener = listenHTTP(settings, &hello);
  8. scope (exit)
  9. {
  10. listener.stopListening();
  11. }
  12. logInfo("Please open http://127.0.0.1:8080/ in your browser.");
  13. runApplication();
  14. }
  15. void hello(HTTPServerRequest req, HTTPServerResponse res)
  16. {
  17. res.writeBody("Hello, World!");
  18. }