demo go server
This commit is contained in:
2 files changed
+25
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
msg := os.Getenv("HELLO_MSG")
|
||||
if msg == "" {
|
||||
msg = "hello from gitea-installed app"
|
||||
}
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, msg)
|
||||
})
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
http.ListenAndServe(":"+port, nil)
|
||||
}
|
||||
Reference in new issue
Block a user