24 lines
464 B
Go
24 lines
464 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
// Serve static files from the "static" directory
|
|
fs := http.FileServer(http.Dir("./static"))
|
|
|
|
// Serve static content at the root URL ("/")
|
|
http.Handle("/", http.StripPrefix("/", fs))
|
|
|
|
// Log the server status
|
|
log.Println("Serving at http://localhost:8080")
|
|
|
|
// Start the web server on port 8080
|
|
err := http.ListenAndServe(":8080", nil)
|
|
if err != nil {
|
|
log.Fatal("ListenAndServe: ", err)
|
|
}
|
|
}
|