Created
September 30, 2017 16:24
-
-
Save gsingharoy/f88b24ebdff61727c6fe9f95d2d2dfb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/julienschmidt/httprouter" | |
/* | |
Define all the routes here. | |
A new Route entry passed to the routes slice will be automatically | |
translated to a handler with the NewRouter() function | |
*/ | |
type Route struct { | |
Name string | |
Method string | |
Path string | |
HandlerFunc httprouter.Handle | |
} | |
type Routes []Route | |
func AllRoutes() Routes { | |
routes := Routes{ | |
Route{"Index", "GET", "/", Index}, | |
Route{"BookIndex", "GET", "/books", BookIndex}, | |
Route{"Bookshow", "GET", "/books/:isdn", BookShow}, | |
Route{"Bookshow", "POST", "/books", BookCreate}, | |
} | |
return routes | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment