about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Let's be specific about the source of the param.Franck Cuny2013-04-212-4/+4
| | | | | | Parameters can come from the URL, but also the query string or the body. For now we create a function ParamRoute to be explicit about which param we want.
* Add a simple test for the request type.Franck Cuny2013-04-211-0/+32
|
* Add a constructor to create the Request object.Franck Cuny2013-04-212-5/+9
| | | | | Some logic will be needed to create this object, it's easier to do that with a constructor.
* Normalize the name of captured components.Franck Cuny2013-04-211-2/+9
| | | | | | In the case of an optional components, the name is ":something". We need to normalize that name in order to be able to call directly "something" when needed.
* Apply gofmtFranck Cuny2013-04-212-5/+5
|
* Simplify the dispatch's workflow.Franck Cuny2013-04-215-24/+31
| | | | | | | | Forward the http.Request object to the Dispatcher's Match function, and instead of returning the route that match, return the whole Match object. We create our own Request object later in the process.
* Rename the type fn to fns and add a real type fnFranck Cuny2013-04-211-4/+5
|
* Small improvementsFranck Cuny2013-04-213-17/+11
| | | | | Don't mess with the first / for now, we will see later if we need to change it.
* Disambiguate routes when more than one match.Franck Cuny2013-04-214-14/+84
| | | | | | | | | For some path, more than one route can match. We try hard to disambiguate them, and if we can't, we return an error with the list of routes matching the request. In order to do that, the Match function needs to be able to also return an error in addition to a route.
* Add support for optional parameter in a path.Franck Cuny2013-04-212-7/+43
| | | | | | If a component in the path starts with "?:", it means that it's optional. We then store the lenght of the components without those optional parameters.
* Add very simple test to validate routes.Franck Cuny2013-04-211-0/+46
|
* The test was inversed.Franck Cuny2013-04-211-1/+1
|
* Clean the Path from useless /.Franck Cuny2013-04-212-1/+17
| | | | If a path starts with /, remove it.
* Support parameters in URL.Franck Cuny2013-04-212-19/+60
| | | | | | | | | | | | | | When creating a new route, check if the URL contains some elements with a ":" in it. If that's the case, it means that this component is a parameter. For now we consider that all the parameters are required, but in the future we should support optional parameters (starting with a ?). When dispatching a request, verify if the element in the url is a parameter and store it in the response. When a route match a request, a Match structure is returned with some information (path that matched, the route, the HTTP method, etc.).
* Very simple implementation for the framework.Franck Cuny2013-04-175-0/+158
| | | | | | | | | | | | For now the framework provide a "dispatcher" and a mechanism to add routes. The type "route" provide a constructor so some logic can be applied before creating the type. The way the dispatcher works for now is very stupid: it looks for all the registered routes, and check if it's the right HTTP method and if the patch matches. The next step is to deal with place holder in the path.
* Welcome to mooh.Franck Cuny2013-04-171-0/+12
This is yet another web framework in golang. I'm using it as a playground for ideas and concept. I've no idea if this will be one day useable.