2024-06-25 17:35:30 +00:00
|
|
|
package main
|
|
|
|
|
2024-06-25 20:17:08 +00:00
|
|
|
import (
|
2024-08-22 19:53:27 +00:00
|
|
|
"encoding/json"
|
2024-06-25 20:17:08 +00:00
|
|
|
"net/http"
|
|
|
|
)
|
2024-06-25 17:35:30 +00:00
|
|
|
|
|
|
|
func (app *application) home(writer http.ResponseWriter, request *http.Request) {
|
2024-06-25 20:17:08 +00:00
|
|
|
data := templateData{
|
2024-09-24 20:16:08 +00:00
|
|
|
AppLinks: app.appLinks,
|
2024-06-25 20:17:08 +00:00
|
|
|
Tier: app.tier,
|
2024-07-09 16:11:48 +00:00
|
|
|
BaseUri: app.domain,
|
2024-06-25 20:17:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
app.render(writer, request, http.StatusOK, "home.tmpl.html", data)
|
2024-06-25 21:28:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (app *application) notFound(writer http.ResponseWriter, request *http.Request) {
|
|
|
|
app.render(writer, request, http.StatusNotFound, "404.tmpl.html", templateData{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (app *application) vpn(writer http.ResponseWriter, request *http.Request) {
|
|
|
|
app.render(writer, request, http.StatusOK, "vpn.tmpl.html", templateData{})
|
2024-08-22 19:53:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (app *application) appList(writer http.ResponseWriter, request *http.Request) {
|
2024-09-24 20:16:08 +00:00
|
|
|
writer.Header().Set("Content-Type", "application/json")
|
|
|
|
|
|
|
|
data, err := json.Marshal(app.appLinks)
|
2024-08-22 19:53:27 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
app.serverError(writer, request, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
writer.Write(data)
|
2024-06-25 17:35:30 +00:00
|
|
|
}
|