digitalmars.D.announce - Hunt framework 2.0.0 released
- zoujiaqing (235/235) Jan 29 2019 The HuntLabs team is happy to announce the release of Hunt
- Dejan Lekic (3/5) Jan 29 2019 Looks impressive. I like the fact that VibeD has some competition
- zoujiaqing (2/7) Jan 31 2019 We will provide usage examples in the next two weeks :)
- Johannes Loher (2/3) Jan 29 2019 It's really great to see your continued efforts. Keep up the good work!
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (8/10) Feb 01 2019 Is there an online comparison describing the differences between
The HuntLabs team is happy to announce the release of Hunt
Framework 2.0.
In Hunt Framework 2.0, we have made many improvements and
implemented many new features. For example, the old libraries of
Collie and Kiss are replaced with Hunt-HTTP and Hunt. Here are
some highlights:
- More powerfull HTTP 1.x parser and APIs.
- HTTP 2.0 support.
- I/O Performance improvements.
- New view template engine.
- Form validation supported.
- Breadcrumbs support in View.
- I18N support in View and Controller.
- Pagination for Entity & EQL supported.
- STOMP-based WebSocket development.
- More Java-alike APIs and modules (like containers, concurrent
etc.)
- Many new libraries added (like hunt-net, hunt-imf, hunt-sql
etc.)
- More unit tests and examples.
| Name | Version |
|--------|--------|
| hunt | 1.0.0 |
| hunt-cache | 0.2.2 |
| hunt-database | 1.1.0 |
| hunt-entity | 2.2.0 |
| hunt-framework | 2.0.0-rc.4 |
| hunt-http | 0.0.14 |
| hunt-imf | 0.0.4 |
| hunt-net | 0.0.14 |
| hunt-security | 0.0.6 |
| hunt-sql | 1.0.5 |
| hunt-stomp | 0.0.3 |
| hunt-trace | 0.1.7 |
| hunt-validation | 0.0.2 |
| boringssl | 0.0.1 |
| dredis | 0.0.9 |
| libmemcached | 1.1.1 |
| openssl | 1.1.6+1.0.1g |
| protobuf | 0.4.0 |
| rocksdb | 0.0.7|
The Collie and Kiss are replaced with Hunt-HTTP and Hunt.
1. Array support
test.conf
```ini
servers[0].listen = 8.8.6.1
servers[0].port = 81
servers[1].listen = 8.8.6.2
servers[1].port = 82
ages = 20, 30, 40
users = user01, user02, user03
```
The setting code
```d
Configuration("server")
struct ServerSettings
{
Value("listen")
string ip = "127.0.0.1";
ushort port = 8080;
}
class ArrayTestConfig {
string name;
int[] ages;
string[] users;
ServerSettings[] servers;
}
```
1. Define language resources in the folder of
resources/translations/en-us/messages.ini
```ini
WELCOME=Welcome to the world of hunt framework.
VERSION_TITLE=Hunt framework version %s
```
2. Set default langauge in config/application.conf
```ini
hunt.application.defaultLanguage = en-us
hunt.application.languages = zh-cn,en-us
```
3. Using language resources in View
```html
<title>{{ trans("VERSION_TITLE", huntVersion) }}</title>
```
4. Using language resources in Controller
```d
assert(transf("title", "Hunt") == "Hunt Demo");
```
```D
app.onBreadcrumbsInitializing((BreadcrumbsManager breadcrumbs) {
breadcrumbs.register("home", (Breadcrumbs trail, Object[]
params...) {
trail.push("Home", "/home");
});
breadcrumbs.register("index.show", (Breadcrumbs trail,
Object[] params...) {
trail.parent("home");
trail.push("About", url("index.show"));
});
}
```
```d
view.assign("breadcrumbs", breadcrumbsManager.generate("home"));
```
```html
{% if breadcrumbs.defined and breadcrumbs.length>0 %}
<div class="row">
<div class="col">
<ol class="breadcrumb">
{% for item in breadcrumbs %}
{% if item.link and not loop.last %}
<li class="breadcrumb-item"><a href="{{
item.link }}">{{ item.title }}</a></li>
{% else %}
<li class="breadcrumb-item active">{{
item.title }}</li>
{% endif %}
{% endfor %}
</ol>
</div>
</div>
{% endif %}
```
```d
Action
Response download()
{
return new FileResponse("/tmp/orders-20190122.zip");
}
```
Read More:
https://github.com/huntlabs/hunt-framework/wiki/FileResponse
```D
Action
string upload()
{
string message;
if (request.hasFile("file1"))
{
auto file = request.file("file1");
if (file.isValid())
{
if (file.store("uploads/myfile.zip"))
{
message = "upload is successed";
}
else
{
message = "save as error";
}
}
else
{
message = "file is not valid";
}
}
else
{
message = "not get this file";
}
return message;
}
```
Read More: https://github.com/huntlabs/hunt-framework/wiki/Upload
```D
module app.form.LoginForm;
import hunt;
class LoginForm : Form
{
mixin MakeForm;
Length(6,20)
string username;
Length(8,16)
string password;
}
```
```D
Action
string login(LoginForm loginForm)
{
string message;
auto result = loginForm.valid();
// TODO
if(!result.isValid)
{
message = "Valid error message : " ~ result.messages();
}
else
{
message = "OK";
}
return message;
}
```
Read More: https://github.com/huntlabs/hunt-framework/wiki/Form
1. Pagination
See: https://github.com/huntlabs/hunt-entity/wiki/Pagination
2. EQL
https://github.com/huntlabs/hunt-entity/wiki/EQL
3. Validation
https://github.com/huntlabs/hunt-entity/wiki/Validation
See:
https://forum.dlang.org/thread/wniszxitzdcuiveqzbap forum.dlang.org
New modules used to tracing the requests in microservice
architectures.
The core I/O library is refactored, and is called Hunt.

See: https://github.com/huntlabs/hunt-minihttp
hunt-skeleton: https://github.com/huntlabs/hunt-skeleton
hunt-examples: https://github.com/huntlabs/hunt-examples
hunt-minihttp: https://github.com/huntlabs/hunt-minihttp
hunt-http:
https://github.com/huntlabs/hunt-http/tree/master/examples
https://www.huntlabs.net
https://github.com/huntlabs/hunt-framework
https://gitee.com/huntlabs/hunt-framework
Jan 29 2019
On Tuesday, 29 January 2019 at 10:00:22 UTC, zoujiaqing wrote:The HuntLabs team is happy to announce the release of Hunt Framework 2.0.Looks impressive. I like the fact that VibeD has some competition - it is healthy that way. Good job guys!
Jan 29 2019
On Tuesday, 29 January 2019 at 10:41:48 UTC, Dejan Lekic wrote:On Tuesday, 29 January 2019 at 10:00:22 UTC, zoujiaqing wrote:We will provide usage examples in the next two weeks :)The HuntLabs team is happy to announce the release of Hunt Framework 2.0.Looks impressive. I like the fact that VibeD has some competition - it is healthy that way. Good job guys!
Jan 31 2019
Am 29.01.19 um 11:00 schrieb zoujiaqing:[...]It's really great to see your continued efforts. Keep up the good work!
Jan 29 2019
On Tuesday, 29 January 2019 at 10:00:22 UTC, zoujiaqing wrote:The HuntLabs team is happy to announce the release of Hunt Framework 2.0.Is there an online comparison describing the differences between Hunt and Vibe.d? I'm mainly interested in - fast incremental compilation, - high run-time performance and - expressiveness In other words, how to most easily get the job done with the least amount of code.
Feb 01 2019









zoujiaqing <zoujiaqing gmail.com> 