Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created March 27, 2024 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save podhmo/272b75576d7128af6452e2db4db4b2b5 to your computer and use it in GitHub Desktop.
Save podhmo/272b75576d7128af6452e2db4db4b2b5 to your computer and use it in GitHub Desktop.
package main
import (
"embed"
"net/http"
)
//go:embed index.html
//go:embed style.css
var public embed.FS
func main() {
mux := http.NewServeMux()
// mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(public))))
mux.Handle("/", http.FileServer(http.FS(public)))
if err := http.ListenAndServe(":8080", mux); err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment