Skip to content

Instantly share code, notes, and snippets.

@jonahgeorge
Created June 14, 2017 06:51
Show Gist options
  • Save jonahgeorge/865d4678702cae9794da0b047d0e4bfb to your computer and use it in GitHub Desktop.
Save jonahgeorge/865d4678702cae9794da0b047d0e4bfb to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"log"
"io/ioutil"
"github.com/russross/blackfriday"
)
const FILENAME = "../jonahgeorge.github.io/_posts/2017-06-13-getting-go-ing.md"
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
f, _ := ioutil.ReadFile(FILENAME)
unsafe := blackfriday.MarkdownCommon(f)
w.Header().Set("Content-Type", "text/html")
fmt.Fprintf(w, "%s", unsafe)
})
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment