Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created August 22, 2022 06:17
Show Gist options
  • Save percybolmer/eeb51ed8e666403078cfe25c0c8264d4 to your computer and use it in GitHub Desktop.
Save percybolmer/eeb51ed8e666403078cfe25c0c8264d4 to your computer and use it in GitHub Desktop.
simple hosting of frontend dir
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