chore: worked on #46, closes #45

This commit is contained in:
2023-10-24 22:35:11 +01:00
parent c844aeabe4
commit beeb42be56
5 changed files with 138 additions and 36 deletions

View File

@@ -563,12 +563,12 @@ func (x Handle) ReadTypesFiles(pathTest string, baseFilePath string, fileTypes [
// fmt.Printf("Requested path: %s\n", user_path)
found := false
index := -1;
index := -1
for i, fileType := range fileTypes {
if strings.HasSuffix(user_path, fileType) {
found = true
index = i;
index = i
break
}
}
@@ -637,5 +637,11 @@ func NewHandler(db *sql.DB) *Handle {
func (x Handle) Startup() {
fmt.Printf("Starting up!\n")
log.Fatal(http.ListenAndServe(":8000", nil))
port := os.Getenv("PORT")
if port == "" {
port = "8000"
}
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}