Add main.go
This commit is contained in:
20
main.go
Normal file
20
main.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "Hello from Dockerized Go App!")
|
||||||
|
})
|
||||||
|
|
||||||
|
http.HandleFunc("/time", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "Current time: %s", time.Now().Format(time.RFC1123))
|
||||||
|
})
|
||||||
|
|
||||||
|
fmt.Println("Server starting on :8080...")
|
||||||
|
http.ListenAndServe(":8080", nil)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user