Files
fnx_web/main.go

31 lines
711 B
Go
Raw Normal View History

2017-11-10 12:39:55 +01:00
package main
import (
2018-09-22 17:27:48 +02:00
"flag"
2017-11-10 12:39:55 +01:00
"net/http"
2020-07-29 17:27:36 +02:00
web "fornaxian.tech/pixeldrain_web/init"
2017-11-10 12:39:55 +01:00
"github.com/Fornaxian/log"
2017-11-10 12:39:55 +01:00
"github.com/julienschmidt/httprouter"
)
// This is just a launcher for the web server. During testing the app would
// be directly embedded by another Go project. And when deployed it will run
// independently.
func main() {
2018-09-22 17:27:48 +02:00
var listen = flag.String("listen", ":8081", "The address which the API server will listen on")
var prefix = flag.String("prefix", "", "Prefix that comes before the API URL")
flag.Parse()
2017-11-10 12:39:55 +01:00
r := httprouter.New()
2018-09-22 17:27:48 +02:00
web.Init(r, *prefix, true)
2017-11-10 12:39:55 +01:00
2018-09-22 17:27:48 +02:00
err := http.ListenAndServe(*listen, r)
2017-11-10 12:39:55 +01:00
if err != nil {
log.Error("Can't listen and serve Pixeldrain Web: %v", err)
}
}