mirror of
https://github.com/zhengkai/orca.git
synced 2026-02-08 08:02:27 +08:00
33 lines
549 B
Go
33 lines
549 B
Go
package web
|
|
|
|
import (
|
|
"net/http"
|
|
"project/config"
|
|
"project/core"
|
|
"project/zj"
|
|
"time"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
// Server ...
|
|
func Server() {
|
|
|
|
mux := http.NewServeMux()
|
|
|
|
mux.Handle(`/_metrics`, promhttp.Handler())
|
|
mux.HandleFunc(`/`, core.NewCore().WebHandle)
|
|
|
|
s := &http.Server{
|
|
Addr: config.WebAddr,
|
|
Handler: mux,
|
|
ReadTimeout: 30 * time.Second,
|
|
WriteTimeout: 30 * time.Second,
|
|
IdleTimeout: 30 * time.Second,
|
|
}
|
|
|
|
zj.J(`start web server`, config.WebAddr)
|
|
|
|
s.ListenAndServe()
|
|
}
|