Mercurial > gemma
comparison cmd/tokenserver/main.go @ 14:afc0de09231f
Fix path in tokenserver. Fix configuration in client.
After reorganizing and merging the tokenserver with the current frontendcode
were two defects:
1) The run:both command for yarn the toplevel path as origin.
Now to start from the client folder, the command has to be relative to that.
2) The api prefix was doubled for the tokenserver route.
The subpaths are '/' and '/token', not '/api/token'
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 20 Jun 2018 17:21:32 +0200 |
parents | 000adddf74c8 |
children | 05d828374256 |
comparison
equal
deleted
inserted
replaced
13:88d0d60924cf | 14:afc0de09231f |
---|---|
43 host := flag.String("host", "localhost", "host to listen at.") | 43 host := flag.String("host", "localhost", "host to listen at.") |
44 flag.Parse() | 44 flag.Parse() |
45 p, _ := filepath.Abs("./web") | 45 p, _ := filepath.Abs("./web") |
46 mux := http.NewServeMux() | 46 mux := http.NewServeMux() |
47 mux.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir(p)))) | 47 mux.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir(p)))) |
48 mux.HandleFunc("/api/token", token) | 48 mux.HandleFunc("/token", token) |
49 api := http.NewServeMux() | 49 api := http.NewServeMux() |
50 api.Handle("/api/", http.StripPrefix("/api", mux)) | 50 api.Handle("/api/", http.StripPrefix("/api", mux)) |
51 | 51 |
52 addr := fmt.Sprintf("%s:%d", *host, *port) | 52 addr := fmt.Sprintf("%s:%d", *host, *port) |
53 log.Fatalln(http.ListenAndServe(addr, api)) | 53 log.Fatalln(http.ListenAndServe(addr, api)) |