Hunt Framework 2.2.0 發佈,穩定性得到全面提升

Hunt framework 是一個由 HuntLabs 推出使用 DLang 語言開發的全棧 web 框架,易用性和完整性都貼近於 Laravel / Django / Spring boot 等主流框架的設計,優勢主要體現在部署方面,不需要搭建運行環境就可開啟 web 服務。而且 D 語言自身是一個性能極高的編譯型語言,我們可以基於 hunt framework 非常簡單的開發出高性能的 Web 服務。

本次更新基本上是 hunt framework 2.x 版本的最後一個系列,所以後面 2.x 系列都是針對穩定性和性能進行優化改進,後面的工作全面針對 3.0.0 里程碑版本躍進。

主要更新

  • 修復 Request 請求過程中 data 可能為空的情況
  • 使用 DataTime 替代 DateTimeHelper
  • 增強改進控制器 Dispatcher
  • 增強靜態文件訪問
  • 升級 hunt-http 庫到 0.4.0 正式版
  • 修復 XPoweredBy 問題
  • 修復 Response 相應的 Content-Type 和 Length 問題
  • 使用全新的 hunt-redis 庫替代舊的 dredis 協議庫
  • 增強 Request 中真實 IP 地址獲取功能
  • 改進 form 表單綁定功能
  • 使用全新的 hunt-database 作為底層數據庫驅動,不再依賴 libmysql / libpq

簡單示例代碼

主文件代碼: app.d

import hunt.framework;
void main()
{
app().run();
}

控制器代碼: app/controller/IndexController.d

module app.controller.IndexController;
import hunt.framework;
class HelloController : Controller
{
mixin MakeController;
@Action
string world()
{
return "Hello world!";
}
}

路由配置文件 config/routes

GET / hello.world

編譯代碼命令

dub run

看效果使用瀏覽器訪問(默認端口 8080)

http://localhost:8080

源碼獲取

  • 碼雲 https://gitee.com/huntlabs/hunt-framework
  • Github
    https://github.com/huntlabs/hunt-framework

文章轉載自 OSCHINA 社區 [http://www.oschina.net]

本文標題:Hunt Framework 2.2.0 發佈,穩定性得到全面提升

本文地址:https://www.oschina.net/news/111127/hunt-framework-2-2-0-released


分享到:


相關文章: