Last active
July 1, 2022 16:16
-
-
Save jerryan999/109f068d757476b65d0163b08e9c331b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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