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