Mercurial > gemma
changeset 4:ac5529cb20ba
Added API as routing prefix and change default port to 8000
in order to improve integration with frontend app.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 13 Jun 2018 11:20:49 +0200 |
parents | 9c6f68a8e8b2 |
children | 1d1236b72e5e |
files | cmd/tokenserver/main.go |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd/tokenserver/main.go Mon Jun 11 12:10:14 2018 +0200 +++ b/cmd/tokenserver/main.go Wed Jun 13 11:20:49 2018 +0200 @@ -42,14 +42,16 @@ } func main() { - port := flag.Int("port", 8080, "port to listen at.") + port := flag.Int("port", 8000, "port to listen at.") host := flag.String("host", "localhost", "host to listen at.") flag.Parse() mux := http.NewServeMux() mux.HandleFunc("/", index) mux.HandleFunc("/token", token) + api := http.NewServeMux() + api.Handle("/api", mux) addr := fmt.Sprintf("%s:%d", *host, *port) - log.Fatalln(http.ListenAndServe(addr, mux)) + log.Fatalln(http.ListenAndServe(addr, api)) }