Archttp 0.1.0 release update, as easy as ExpressJS!

Archttp is a lightweight framework written by DLang, and its performance is comparable to Fasthttp, but the syntax is clear and clear. This adjustment is also more inclined to the lightweight design of ExpressJS, which is very elegant, and the development experience can be expressed in an excellent way.

Overall API simplification

Now the callback method directly returns the request and response instead of returning the context as before, which is easier to use. The startup process also merges Bind() and Run() into Listen(), so that the developer's code is the same as writing one less line!


import archttp;

void main()
{
    auto app = new Archttp;

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

    app.Listen(8080);
}

Support cookie writing


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);
}

Support sendFile() method to realize file download


import archttp;

void main()
{
    auto app = new Archttp;

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

    app.Listen(8080);
}

Then..

Many bugs have also been fixed to further improve the stability, and it is also compatible with the testing of the Windows platform. Since the author's development machine system is macOS, there is only one Debian virtual machine for compatibility with Linux testing. I also hope that you can test and give feedback BUG to the author is very welcome!

D language is a very good language. Its syntax is similar to TypeScript, and its performance is comparable to Rust and Golang. I hope I can develop a simple framework like ExpressJS to do things as high as Golang!

Guess you like

Origin www.oschina.net/news/196228/archttp-0-1-0-released