Route to /api/ when on prod
This commit is contained in:
@@ -3,6 +3,7 @@ package utils
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetURL(r *http.Request) string {
|
func GetURL(r *http.Request) string {
|
||||||
@@ -17,7 +18,10 @@ func GetURL(r *http.Request) string {
|
|||||||
// Get the full request URI (path + query string)
|
// Get the full request URI (path + query string)
|
||||||
fullPath := r.URL.Path
|
fullPath := r.URL.Path
|
||||||
|
|
||||||
|
if os.Getenv("ENVIRONMENT") != "DEVELOPMENT" {
|
||||||
|
fullPath += "/api/"
|
||||||
|
}
|
||||||
|
|
||||||
// Build the full request URL
|
// Build the full request URL
|
||||||
return fmt.Sprintf("%s://%s%s", scheme, host, fullPath)
|
return fmt.Sprintf("%s://%s%s", scheme, host, fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user