Starter net/http server

This commit is contained in:
Pavak Paul 2022-04-21 01:54:07 +05:30
parent f7ac4dabf3
commit 18c67410d3

20
main.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"net/http"
)
const port = ":5000"
func Home(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
func main() {
http.HandleFunc("/", Home)
fmt.Printf("Starting web server on http://localhost%s\n", port)
_ = http.ListenAndServe(port, nil)
}