This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
JISQueueing/main.go

30 lines
758 B
Go

2019-09-05 01:54:21 +07:00
package main
import (
"JISQueueing/server"
"flag"
2020-01-31 03:03:02 +07:00
"log"
"net/http"
"strconv"
2020-01-31 03:03:02 +07:00
"github.com/gorilla/handlers"
)
2019-09-05 01:54:21 +07:00
func main() {
var port int
var debug bool
2020-01-31 03:03:02 +07:00
flag.IntVar(&port, "port", 443, "Specify port for socket and webserver")
flag.BoolVar(&debug, "debug", false, "Specify the debug mode status")
2020-01-31 03:03:02 +07:00
flag.Parse()
hostLocation := ":" + strconv.Itoa(port)
mux := server.NewServerMux(debug)
2020-01-31 03:03:02 +07:00
cors := handlers.CORS(
handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization"}),
handlers.AllowedMethods([]string{"POST", "OPTIONS"}),
handlers.AllowedOrigins([]string{"*"}),
)(mux)
//log.Fatal(http.ListenAndServe(hostLocation, cors))
log.Fatal(http.ListenAndServeTLS(hostLocation, "server.crt", "server.key", cors))
2019-09-05 01:54:21 +07:00
}