Skip to content

Instantly share code, notes, and snippets.

@smd686s
Forked from jakejscott/server.go
Created August 23, 2014 23:33
Show Gist options
  • Save smd686s/9bf19f59e160cbd65613 to your computer and use it in GitHub Desktop.
Save smd686s/9bf19f59e160cbd65613 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
// mux := http.NewServeMux()
// mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
// fmt.Fprintln(w, "Welcome to the homepage using http router")
// })
router := httprouter.New()
router.GET("/", func(w http.ResponseWriter, req *http.Request, _ map[string]string) {
fmt.Fprintln(w, "Welcome to the homepage using http router")
})
n := negroni.Classic()
//n.UseHandler(mux)
n.UseHandler(router)
n.Run(":9999")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment