weixin_39732866 2020-11-19 11:29
浏览 0

Implement http2 server

  • [x] Have a different branch
  • [x] Generate "mock" certs
  • [x] Implement Go
  • [x] Implement in Node - see https://github.com/ericmdantas/generator-ng-fullstack/issues/96#issuecomment-197285514
  • [x] Create options (http or http2)
  • [x] Cleanup
  • 写回答

7条回答 默认 最新

  • weixin_39732866 2020-11-19 11:29
    关注

    Go server:

     go
    package main
    
    import (
        "fmt"
        "net/http"
    
        "golang.org/x/net/http2"
    )
    
    func main() {
        var srv http.Server
        http2.VerboseLogs = true
        srv.Addr = ":3333"
        http2.ConfigureServer(&srv, nil)
    
        http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
            w.Write([]byte("yo!"))
        })
    
        log.Fatal(srv.ListenAndServeTLS("crt/server.crt", "crt/server.key"))
    }
    
    评论

报告相同问题?