handy-httpd 2.0.0

Extremely lightweight HTTP server for D.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

handy-httpd

An extremely lightweight HTTP server for the D programming language.

For a complete overview, please visit the wiki.

Here's an example of serving static files from a directory:

import handy_httpd;
import handy_httpd.handlers.file_resolving_handler;

void main() {
	new HttpServer(new FileResolvingHandler("static")).start();
}

It's also quite simple to define your own custom request handler. Here's an example of a custom request handler that only responds to the /hello endpoint:

import handy_httpd;
import handy_httpd.responses;

void main() {
	auto s = new HttpServer(simpleHandler((ref request, ref response) {
		if (request.url == "/hello") {
			response.writeBody("Hello world!");
		} else {
			response.notFound();
		}
	}));
	s.start();
}
Authors:
Dependencies:
httparsed
Versions:
8.4.0 2024-Apr-16
8.3.2 2024-Feb-16
8.3.1 2024-Feb-14
8.3.0 2024-Jan-30
8.2.0 2024-Jan-27
Show all 71 versions
Download Stats:
  • 7 downloads today

  • 14 downloads this week

  • 93 downloads this month

  • 18941 downloads total

Score:
3.0
Short URL:
handy-httpd.dub.pm