May 17, 2022

Archttp is a lightweight framework written by DLang. Its performance is comparable to Fasthttp, but its syntax is clear and clear. This adjustment also prefers ExpressJS with lightweight design, which is very elegant and can express the development experience with excellent expression.

Overall API simplification

Now the callback method returns request and response directly instead of context, making it easier to use. Bind () and Run () are merged into Listen () during startup, saving developers a line of code.


import archttp;

void main()
{
    auto app = new Archttp;

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

    app.Listen(8080);
}

Cookie writing support


import archttp;

void main()
{
    auto app = new Archttp;

    app.Get("/cookie", (request, response) {
        response.cookie("username", "myuser");
        response.cookie(new Cookie("token", "0123456789"));
        response.send("Set cookies ..");
    });

    app.Listen(8080);
}

The sendFile () method is supported to download files


import archttp;

void main()
{
    auto app = new Archttp;

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

    app.Listen(8080);
}

Then..

It is also compatible with the Windows platform test. As the author's development machine system is macOS, there is only one Debian VIRTUAL machine for Linux compatibility test. We also hope that you can experience the test, and feedback on bugs to the author is very welcome!

D is an excellent language with a syntax similar to TypeScript scripting languages and performance comparable to Rust and Golang. I wish I could develop an ExpressJS framework as simple as Golang's!

May 17, 2022

Project

https://github.com/kerisy/archttp

How to use archttp?

git clone https://github.com/kerisy/archttp.git
cd archttp/examples/httpserver/
dub run

Go to http://localhost:8080