Skip to content

Instantly share code, notes, and snippets.

@jerryan999
Last active July 1, 2022 16:16
Show Gist options
  • Save jerryan999/109f068d757476b65d0163b08e9c331b to your computer and use it in GitHub Desktop.
Save jerryan999/109f068d757476b65d0163b08e9c331b to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, 世界")
}
func main() {
var port = os.Getenv("PORT")
fmt.Println(port)
http.HandleFunc("/", handler)
fmt.Println("Running demo app. Press Ctrl+C to exit...")
log.Fatal(http.ListenAndServe(":"+port, nil))
}
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, 世界")
}
func main() {
var jsonFile, err = os.Open("config.json")
if err != nil {
log.Fatal(err)
}
fmt.Println(jsonFile)
http.HandleFunc("/", handler)
fmt.Println("Running demo app. Press Ctrl+C to exit...")
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment