1
0
mirror of https://github.com/gusaul/grpcox.git synced 2024-12-26 02:40:10 +00:00
grpcox/grpcox.go

38 lines
705 B
Go
Raw Normal View History

2018-11-04 19:56:06 +00:00
package main
import (
"fmt"
"log"
"net/http"
"os"
2018-11-04 19:56:06 +00:00
"time"
"github.com/gorilla/mux"
"github.com/gusaul/grpcox/handler"
)
func main() {
// logging conf
f, err := os.OpenFile("log/grpcox.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer f.Close()
log.SetOutput(f)
log.SetFlags(log.LstdFlags | log.Lshortfile)
// start app
2018-11-04 19:56:06 +00:00
port := ":6969"
muxRouter := mux.NewRouter()
handler.Init(muxRouter)
srv := &http.Server{
Handler: muxRouter,
2019-03-25 03:47:41 +00:00
Addr: "0.0.0.0" + port,
2018-11-04 19:56:06 +00:00
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
fmt.Println("Service started on", port)
log.Fatal(srv.ListenAndServe())
}