archttp 1.1.1

A highly performant web framework written in 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:

Archttp

A highly performant web framework written in D.

Documents

  1. Quick Start
  2. 快速开始

Example for web server


import archttp;

void main()
{
    auto app = new Archttp;

    app.get("/", (request, response) {
        response.send("Hello, World!");
    });

    app.get("/user/{id:\\d+}", (request, response) {
        response.send("User id: " ~ request.params["id"]);
    });

    app.get("/blog/{name}", (request, response) {
        response.send("Username: " ~ request.params["name"]);
    });

    app.post("/upload", (request, response) {
        response.send("Using post method!");
    });

    app.get("/download", (request, response) {
        response.sendFile("./attachments/avatar.jpg");
    });

    app.get("/json", (request, response) {
        import std.json;
        response.send( JSONValue( ["message" : "Hello, World!"] ) );
    });

    app.get("/cookie", (request, response) {

        import std.stdio : writeln;

        writeln(request.cookie("token"));
        writeln(request.cookies());

        response.cookie("username", "myuser");
        response.cookie(new Cookie("token", "0123456789"));
        response.send("Set cookies ..");
    });

    app.listen(8080);
}

Dependencies

Thanks contributors

  • zoujiaqing
  • Heromyth
  • ikod
  • tchaloupka
  • dhasenan
Dependencies:
geario
Versions:
1.1.1 2022-May-31
1.1.0 2022-May-27
1.0.2 2022-May-27
1.0.1 2022-May-24
1.0.0 2022-May-20
Show all 9 versions
Download Stats:
  • 0 downloads today

  • 3 downloads this week

  • 8 downloads this month

  • 1884 downloads total

Score:
1.6
Short URL:
archttp.dub.pm