30 lines
758 B
Go
30 lines
758 B
Go
package main
|
|
|
|
import (
|
|
"JISQueueing/server"
|
|
"flag"
|
|
"log"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"github.com/gorilla/handlers"
|
|
)
|
|
|
|
func main() {
|
|
var port int
|
|
var debug bool
|
|
flag.IntVar(&port, "port", 443, "Specify port for socket and webserver")
|
|
flag.BoolVar(&debug, "debug", false, "Specify the debug mode status")
|
|
flag.Parse()
|
|
|
|
hostLocation := ":" + strconv.Itoa(port)
|
|
mux := server.NewServerMux(debug)
|
|
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))
|
|
}
|