Skip to content

Instantly share code, notes, and snippets.

View ravidelcj's full-sized avatar

Ravi Prasad ravidelcj

  • Delhi
View GitHub Profile
package main
import (
"fmt"
"io/ioutil"
"net/http"
"io"
)
func getFile(res http.ResponseWriter, req *http.Request) {
func getFile(res http.ResponseWriter, req *http.Request) {
files, _ := ioutil.ReadDir("./publicFolder/")
res.Header().Set("Content-Type", "text/html; charset=utf-8")
myHtml := `
<!DOCTYPE html>
<html>
func main() {
http.HandleFunc("/getFile/", getFile)
http.Handle("/getFile/publicFolder/", http.StripPrefix("/getFile/publicFolder/", http.FileServer(http.Dir("./publicFolder"))))
http.ListenAndServe(":8008", nil)
}
import (
"fmt"
"io/ioutil"
"net/http"
"io"
)