diff --git a/go/l16.go b/go/l16.go new file mode 100644 index 0000000..7ac7d77 --- /dev/null +++ b/go/l16.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "os" + "net/http" + "log" + "github.com/joho/godotenv" +) + +func handler(w http.ResponseWriter, r *http.Request) { + err := godotenv.Load() + if err != nil { + log.Fatalf("%v\n", err) + } + PathFile := os.Getenv("html_file_for_l16.go") // Enter the file path for the html_file_for_l16.go variable into the env file + html, err := os.ReadFile(PathFile) + if err != nil { + log.Fatalf("%v\n", err) + } + fmt.Fprintf(w, string(html)) +} + +func main() { + http.HandleFunc("/", handler) + err := http.ListenAndServe(":2345", nil) + if err != nil { + log.Fatalf("%v\n", err) + } +} \ No newline at end of file diff --git a/go/output/l16 b/go/output/l16 new file mode 100755 index 0000000..a0e0088 Binary files /dev/null and b/go/output/l16 differ