Last Updated: February 25, 2016
·
2.952K
· rydgel

Golang static files server

For example if you want to serve your Jekyll powered blog:

package main

import "net/http"

func main() {
    http.Handle("/", http.FileServer(http.Dir("_site")))
    err := http.ListenAndServe(":8000", nil)
    if err != nil {
        panic(err)
    }
}