企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# Hello World 示例 运行以下代码,通过访问http://127.0.0.1:8080/hello 输出"hello world!" ## 服务器 ~~~go package main import ( "fmt" "github.com/devfeel/dotweb" ) func main() { //初始化DotServer app := dotweb.New() //开启debug模式 app.SetDevelopmentMode() //设置路由 InitRoute(app.HttpServer) //开始服务 port := 8080 err := app.StartServer(port) fmt.Println("dotweb.StartServer error => ", err) } func Hello(ctx dotweb.Context) error { return ctx.WriteString("hello world!") } func InitRoute(server *dotweb.HttpServer) { server.Router().GET("/hello", Hello) } ~~~ ## 示例代码 https://github.com/devfeel/dotweb-example/tree/master/helloworld