Fixed URL bug

This commit is contained in:
Ross Trottier 2024-06-27 11:18:27 -06:00
parent 00c382de7f
commit 147b79eceb

View File

@ -2,18 +2,10 @@ package main
import ( import (
"net/http" "net/http"
"strings"
) )
func (app *application) home(writer http.ResponseWriter, request *http.Request) { func (app *application) home(writer http.ResponseWriter, request *http.Request) {
domain := request.Host baseURI := request.Host
domainPieces := strings.Split(domain, ".")
var baseURI string
if len(domainPieces) > 1 {
baseURI = domainPieces[len(domainPieces) - 2] + domainPieces[len(domainPieces) - 1]
} else {
baseURI = domain
}
data := templateData{ data := templateData{
AppLinks: getAppLinks(app.tier, baseURI), AppLinks: getAppLinks(app.tier, baseURI),