arnaucube
arnaucube/blockchainIDsystemPublic Self-hosted repository
blockchainIDsystem/clientApp/main.go
clientApp/main.goRaw
 1package main
 2
 3import (
 4	"log"
 5	"net/http"
 6
 7	"github.com/fatih/color"
 8	"github.com/gorilla/handlers"
 9)
10
11func main() {
12	color.Blue("Starting blockchainIDsystem clientApp")
13
14	readConfig("config.json")
15
16	//run thw webserver
17	go GUI()
18
19	//run API
20	log.Println("api server running")
21	log.Print("port: ")
22	log.Println(config.Port)
23	router := NewRouter()
24	headersOk := handlers.AllowedHeaders([]string{"X-Requested-With", "Access-Control-Allow-Origin"})
25	originsOk := handlers.AllowedOrigins([]string{"*"})
26	methodsOk := handlers.AllowedMethods([]string{"GET", "HEAD", "POST", "PUT", "OPTIONS"})
27	log.Fatal(http.ListenAndServe(":"+config.Port, handlers.CORS(originsOk, headersOk, methodsOk)(router)))
28}
29
30func GUI() {
31	//here, run electron app
32}