apps endpoint
This commit is contained in:
parent
54052434b4
commit
74b542023f
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@ -23,3 +24,16 @@ func (app *application) notFound(writer http.ResponseWriter, request *http.Reque
|
||||
func (app *application) vpn(writer http.ResponseWriter, request *http.Request) {
|
||||
app.render(writer, request, http.StatusOK, "vpn.tmpl.html", templateData{})
|
||||
}
|
||||
|
||||
func (app *application) appList(writer http.ResponseWriter, request *http.Request) {
|
||||
appLinks := getAppLinks(app.tier, app.domain)
|
||||
writer.Header().Set("Content-Type", "application/json")
|
||||
data, err := json.Marshal(appLinks)
|
||||
|
||||
if err != nil {
|
||||
app.serverError(writer, request, err)
|
||||
return
|
||||
}
|
||||
|
||||
writer.Write(data)
|
||||
}
|
@ -11,6 +11,7 @@ func (app *application) routes() *http.ServeMux {
|
||||
mux.HandleFunc("GET /{$}", app.home)
|
||||
mux.HandleFunc("GET /", app.notFound)
|
||||
mux.HandleFunc("GET /vpn/{$}", app.vpn)
|
||||
mux.HandleFunc("GET /apps/{$}", app.appList)
|
||||
|
||||
return mux
|
||||
}
|
Loading…
Reference in New Issue
Block a user