获得徽章 0
赞了这篇文章
赞了这篇文章
#青训营 x 字节后端训练营#
没有一个冬天不可逾越,没有一个春天不会来临。最慢的步伐不是跬步,而是徘徊,最快的脚步不是冲刺,而是坚持
没有一个冬天不可逾越,没有一个春天不会来临。最慢的步伐不是跬步,而是徘徊,最快的脚步不是冲刺,而是坚持
评论
点赞
#青训营 x 字节后端训练营#
尝试了原生web开发,
import (
"HelloWorld/handler"
"fmt"
"log"
"net/http"
)
func main() {
fmt.Println("Starting the server ...")
helloHandler := handler.NewHelloHandler()
http.Handle("/hello", helloHandler)
log.Fatal(http.ListenAndServe("127.0.0.1:8080", nil))
}
=====================================
import (
"bytes"
"fmt"
"net/http"
)
type HelloHandler struct {
m map[string]string
}
func NewHelloHandler() *HelloHandler {
return &HelloHandler{m: make(map[string]string)}
}
func (h HelloHandler) ServeHTTP(writer http.ResponseWriter, requset *http.Request) {
b := requset.Body
buf := bytes.Buffer{}
buf.ReadFrom(b)
b.Close()
s := buf.String()
fmt.Printf("get request: \nMethod:%s\n%s\n%s\n", requset.Method, requset.RequestURI, s)
writer.Write(buf.Bytes())
}
尝试了原生web开发,
import (
"HelloWorld/handler"
"fmt"
"log"
"net/http"
)
func main() {
fmt.Println("Starting the server ...")
helloHandler := handler.NewHelloHandler()
http.Handle("/hello", helloHandler)
log.Fatal(http.ListenAndServe("127.0.0.1:8080", nil))
}
=====================================
import (
"bytes"
"fmt"
"net/http"
)
type HelloHandler struct {
m map[string]string
}
func NewHelloHandler() *HelloHandler {
return &HelloHandler{m: make(map[string]string)}
}
func (h HelloHandler) ServeHTTP(writer http.ResponseWriter, requset *http.Request) {
b := requset.Body
buf := bytes.Buffer{}
buf.ReadFrom(b)
b.Close()
s := buf.String()
fmt.Printf("get request: \nMethod:%s\n%s\n%s\n", requset.Method, requset.RequestURI, s)
writer.Write(buf.Bytes())
}
展开
评论
点赞
#青训营 x 字节后端训练营#
文章指出了 Go 语言语法简单、并发的天然支持、且为编译语言(和 C 同类)、编译快速、部署便捷、工具链与垃圾回收、并且和 open jdk 一样为开源项目。接下来准备跟着配置环境
文章指出了 Go 语言语法简单、并发的天然支持、且为编译语言(和 C 同类)、编译快速、部署便捷、工具链与垃圾回收、并且和 open jdk 一样为开源项目。接下来准备跟着配置环境
10
1