Serverino 0.4.0
Andrea Fontana
nospam at example.org
Wed Feb 1 17:36:07 UTC 2023
Hi! I've just release a new version of serverino, my pure-D
webserver without 3rd party dependencies, super-fast to compile.
This version is featuring a basic & easy way to add routing using
UDAs.
A big thank you to Ferhat Kurtulmuş that create a pull request
for this :)
Just create a ready-to-go serverino using the project template:
```dub init -t serverino your_server```
And then test the new feature:
```d
import serverino;
mixin ServerinoMain;
@endpoint @route!"/hello/world" // also: @route!(request =>
request.uri == "/hello/world")
void your_request(const Request r, Output o)
{
o ~= "Hello world!";
}
@endpoint @route!(request => r.get.has("item"))
void another_request(const Request r, Output o)
{
o ~= "Item " ~ r.get.read("item");
}
@endpoint @priority(-1)
void this_is_a_fallback(const Request r, Output o)
{
o ~= r.dump();
}
```
More info and docs: https://github.com/trikko/serverino
More information about the Digitalmars-d-announce
mailing list