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
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
- Registered by zoujiaqing
- 1.1.1 released 2 years ago
- kerisy/archttp
- www.kerisy.com
- Apache-2.0
- 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 - Download Stats:
-
-
1 downloads today
-
7 downloads this week
-
20 downloads this month
-
1901 downloads total
-
- Score:
- 2.0
- Short URL:
- archttp.dub.pm