handy-httpd 3.1.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:
  • Andrew Lalis <andrewlalisofficial@gmail.com>
Dependencies:
httparsed
Versions:
3.1.0 2022-Aug-11
3.0.0 2022-Jul-04
2.0.0 2022-Mar-04
1.4.0 2022-Feb-23
1.3.1 2022-Feb-21
Show all 10 versions
Download Stats:
  • 10 downloads today

  • 11 downloads this week

  • 25 downloads this month

  • 63 downloads total

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