mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"lunar-tear/server/internal/service"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
)
|
||||
|
||||
func startHTTP(port int, resourcesBaseURL string) {
|
||||
octoServer := service.NewOctoHTTPServer(resourcesBaseURL)
|
||||
h2s := &http2.Server{}
|
||||
octoHandler := h2c.NewHandler(octoServer.Handler(), h2s)
|
||||
log.Printf("Octo HTTP server listening on :%d (HTTP/1.1 + h2c)", port)
|
||||
srv := &http.Server{Addr: fmt.Sprintf(":%d", port), Handler: octoHandler}
|
||||
http2.ConfigureServer(srv, h2s)
|
||||
if err := srv.ListenAndServe(); err != nil {
|
||||
log.Fatalf("HTTP server on %d failed: %v", port, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user