Skip to content

Instantly share code, notes, and snippets.

@bellx2
Created July 12, 2016 22:19
Show Gist options
  • Save bellx2/5bff918997053cff0923fa694b35e308 to your computer and use it in GitHub Desktop.
Save bellx2/5bff918997053cff0923fa694b35e308 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/julienschmidt/httprouter"
"net/http"
"os"
"fmt"
)
func main(){
router := httprouter.New()
router.GET("/", Index)
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
router.NotFound = http.FileServer(http.Dir("public"))
http.ListenAndServe(":"+port, router)
}
func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
fmt.Fprintln(w, "OK")
}
@bellx2
Copy link
Author

bellx2 commented Jul 12, 2016

go get github.com/julienschmidt/httprouter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment