handy-httpd 1.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:


An extremely lightweight HTTP server for the D programming language. Handy-httpd uses a simple worker pool to process incoming requests, in conjunction with a user-defined HttpRequestHandler. Consider the following example:

import handy_httpd;

void main() {
	auto s = new HttpServer(new FileResolvingHandler());

We create a new HttpServer that is using a FileResolvingHandler (tries to serve static files according to URL path), and start it. It's that simple.

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;

void main() {
	auto s = new HttpServer(simpleHandler((request) {
		if (request.url == "/hello") {
			return okResponse()
				.setBody("Hello world!");
		} else {
			return notFound();

Note: the HttpRequestHandler simpleHandler(HttpResponse function(HttpRequest) fn) function allows you to pass a function as a request handler. Internally, it's using an anonymous class.

Besides these barebones showcases, handy-httpd also gives you the ability to configure almost everything about how the server works, including the following properties:

  • Hostname and port
  • Receive buffer size.
  • Whether to show verbose logging output.
  • Number of worker threads to use for request processing.


Each HTTP request parsed into the following struct for use with any HttpRequestHandler:

struct HttpRequest {
    public const string method;
    public const string url;
    public const int ver;
    public const string[string] headers;
    public const string[string] params;


The following struct is used to send responses from any HttpRequestHandler:

struct HttpResponse {
    ushort status;
    string statusText;
    string[string] headers;
    ubyte[] messageBody;
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:
  • 5 downloads today

  • 32 downloads this week

  • 104 downloads this month

  • 19055 downloads total

Short URL: