摘要: Day 10 http 编程 Go 原生支持 http, import "net/http" Go 的 http 服务性能和 nginx 比较接近 几行代码就可以实现一个 web 服务 简单的例子 package main import ( "fmt" "net/http" ) func Hello 阅读全文
posted @ 2022-04-26 22:49 ty1539 阅读(15) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) var Db *sqlx.DB func init() { database, err := sqlx.Open("m 阅读全文
posted @ 2022-04-26 22:42 ty1539 阅读(29) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "net/http" ) func Hello(w http.ResponseWriter, r *http.Request) { fmt.Println("handle hello 123") fmt.Fprintf(w, "hello 45 阅读全文
posted @ 2022-04-26 22:09 ty1539 阅读(21) 评论(0) 推荐(0) 编辑