dotwebGo 語言 Web 開發(fā)框架
一款簡潔大方的 Go 語言 Web 開發(fā)框架,并輔助以眾多實(shí)用精致功能組件,幫助開發(fā)人員更方便的構(gòu)建應(yīng)用。
1. 相關(guān)特性
- 支持 go mod
- 支持靜態(tài)路由、參數(shù)路由、組路由
- 路由支持文件/目錄服務(wù),支持設(shè)置是否允許目錄瀏覽
- HttpModule 支持,支持路由之前全局級別的自定義代碼能力
- 中間件支持,支持 App、Group、Router 級別的設(shè)置 - https://github.com/devfeel/middleware
- Feature 支持,可綁定 HttpServer 全局啟用
- 支持 STRING/JSON/JSONP/HTML 格式輸出
- 集成 Mock 能力
- 集成 Timeout Hook
- 全局 HTTP 錯(cuò)誤處理
- 全局日志處理
- 支持 Hijack 與 websocket
- 內(nèi)建 Cache 支持
- 內(nèi)建 Session 支持 - 支持主備 redis 自動切換
- 內(nèi)建 TLS 支持
- 支持接入第三方模板引擎(需實(shí)現(xiàn) dotweb.Renderer 接口)
- 模塊可配置
- 自集成基礎(chǔ)統(tǒng)計(jì)數(shù)據(jù),并支持按分鐘為單位的間隔時(shí)間統(tǒng)計(jì)數(shù)據(jù)輸出
2. Getting Started
package main
import (
"fmt"
"github.com/devfeel/dotweb"
)
func main() {
//init DotApp
app := dotweb.New()
//set log path
app.SetLogPath("/home/logs/wwwroot/")
//set route
app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
return ctx.WriteString("welcome to my first web!")
})
//begin server
fmt.Println("dotweb.StartServer begin")
err := app.StartServer(80)
fmt.Println("dotweb.StartServer error => ", err)
}
更多介紹請?jiān)L問項(xiàng)目 github 地址。
評論
圖片
表情
