digitalmars.D.announce - Archttp 0.1.0 releases updates like ExpressJS so simple!
- zoujiaqing (57/57) May 17 2022 Archttp is a lightweight framework written by DLang. Its
- zoujiaqing (9/9) May 17 2022 ### Project
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.
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.
```D
import archttp;
void main()
{
auto app = new Archttp;
app.Get("/", (request, response) {
response.send("Hello, World!");
});
app.Listen(8080);
}
```
```D
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);
}
```
```D
import archttp;
void main()
{
auto app = new Archttp;
app.Get("/download", (request, response) {
response.sendFile("./attachments/avatar.jpg");
});
app.Listen(8080);
}
```
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
https://github.com/kerisy/archttp ```bash git clone https://github.com/kerisy/archttp.git cd archttp/examples/httpserver/ dub run ``` Go to http://localhost:8080
May 17 2022








zoujiaqing <zoujiaqing gmail.com>