Serve static files at root; add ColorPicker README
- Change FileServer base path to “/” to serve static assets from the site root. - Remove the unused helloHandler route registration. - Add README documentation for the new ColorPicker web component.
This commit is contained in:
@@ -16,21 +16,15 @@ func main() {
|
||||
r.Use(middleware.Recoverer)
|
||||
|
||||
// Register the hello world handler at the root path
|
||||
r.Get("/", helloHandler)
|
||||
|
||||
// Serve static HTML files from the "static" directory
|
||||
// (e.g., /static/index.html will be accessible at /static/index.html)
|
||||
FileServer(r, "/static", http.Dir("./static"))
|
||||
FileServer(r, "/", http.Dir("./static"))
|
||||
|
||||
// Start the HTTP server
|
||||
http.ListenAndServe(":8080", r)
|
||||
}
|
||||
|
||||
// helloHandler responds with a simple "Hello, World!" message.
|
||||
func helloHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("Hello, World!"))
|
||||
}
|
||||
|
||||
// FileServer sets up a http.FileServer handler for serving static files.
|
||||
func FileServer(r chi.Router, publicPath string, root http.FileSystem) {
|
||||
if publicPath == "" {
|
||||
|
||||
Reference in New Issue
Block a user