You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
420 B
Go
24 lines
420 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
http.HandleFunc("/a", func(w http.ResponseWriter, r *http.Request) {
|
|
http.ServeFile(w, r, "./index.html")
|
|
})
|
|
http.HandleFunc("/b", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Write([]byte("B"))
|
|
})
|
|
|
|
fmt.Println("Listening on port 8080")
|
|
err := http.ListenAndServe(":8080", nil)
|
|
if err != nil {
|
|
panic(err.Error())
|
|
}
|
|
|
|
fmt.Println("Stopped!")
|
|
}
|