Created
August 22, 2022 06:17
-
-
Save percybolmer/eeb51ed8e666403078cfe25c0c8264d4 to your computer and use it in GitHub Desktop.
simple hosting of frontend dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
func main() { | |
setupAPI() | |
// Serve on port :8080, fudge yeah hardcoded port | |
log.Fatal(http.ListenAndServe(":8080", nil)) | |
} | |
// setupAPI will start all Routes and their Handlers | |
func setupAPI() { | |
// Serve the ./frontend directory at Route / | |
http.Handle("/", http.FileServer(http.Dir("./frontend"))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment