# Path-Router ## What is Path Router Path Router is a playground for me to test ideas and concept for what I want in a dispatcher. ## What Path Router is not It's definitely not designed with speed in mind. Stability in the API and design is not done, so things are changing frequently. ## Documentation ### Route To create a new route, you'll need to create a new Route with the following attributes: * Method * Path * Code * Validations or: &Route{ Method: "GET", Path: "/blog/{year}/{month}/{day}", Code: GetArticle, Validations: map[string]*regexp.Regexp{ "year": regexp.MustCompile("[\\d]{4}"), "month": regexp.MustCompile("[\\d]{2}"), "day": regexp.MustCompile("[\\d]{2}"), }, } The attribute Validations is optional, but all the keys defined in the map need to be parameters in the URL. If you use validation, you can write this kind of route with no ambiguity: &Route{ Method: "GET", Path: "/user/{id}", Code: GetUserById, Validations: map[string]*regexp.Regexp{ "id": regexp.MustCompile("[\\d]+"), } } &Route{ Method: "GET", Path: "/user/{name}", Code: GetUserByName, Validations: map[string]*regexp.Regexp{ "id": regexp.MustCompile("[a-zA-Z]+"), } } ## External links * [![Build Status](https://travis-ci.org/franckcuny/path-router.png?branch=master)](https://travis-ci.org/franckcuny/path-router) * [Internal Documentation](http://godoc.org/github.com/franckcuny/path-router)