1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

38 lines
589 B
Go
Raw Normal View History

2017-05-16 13:39:59 +02:00
package main
2017-05-16 15:22:40 +02:00
import (
"log"
"net/http"
2017-05-16 17:24:08 +02:00
"github.com/julienschmidt/httprouter"
2017-05-16 15:22:40 +02:00
)
2017-05-16 13:39:59 +02:00
2017-05-18 15:23:36 +02:00
var AliceConfig *Config
2017-05-16 13:39:59 +02:00
func main() {
2017-05-18 15:23:36 +02:00
var err error
2017-05-16 13:39:59 +02:00
printBanner()
2017-05-16 15:22:40 +02:00
// Load configuration
2017-05-18 15:23:36 +02:00
AliceConfig, err = loadConfigs("../etc/alicelg/alice.conf", "", "")
2017-05-16 16:00:01 +02:00
log.Println("Using configuration: ...")
2017-05-16 15:22:40 +02:00
2017-05-16 17:24:08 +02:00
// Setup request routing
router := httprouter.New()
2017-05-16 16:00:01 +02:00
// Serve static content
2017-05-18 15:23:36 +02:00
err = httpRegisterAssets(router)
2017-05-16 17:24:08 +02:00
if err != nil {
log.Fatal(err)
}
2017-05-16 15:22:40 +02:00
2017-05-18 15:23:36 +02:00
err = apiRegisterEndpoints(router)
2017-05-18 14:44:50 +02:00
if err != nil {
log.Fatal(err)
}
2017-05-16 15:22:40 +02:00
// Start http server
2017-05-16 17:24:08 +02:00
log.Fatal(http.ListenAndServe(":7340", router))
2017-05-16 13:39:59 +02:00
}