rejectedsoftware/vibe.d — pull request #177 by bluepeppers (2013-02-06 16:23:35+00:00)
Title: Added IHttpRouter interface

I've been implementing my own router class recently, and I've felt the need for an interface for Http Routers in two ways:

* The UrlRouter public API is 90% convenience functions, with only 2 functions that actually do work (match and handleRequest). By using an interface, the convenience functions need not be explicitly implemented by any other routers, and new routers need only implement match and handleRequest.
* Having a base type for routers is really useful for creating generic/pluggable site components. I don't know what the standard way of organising vibe.d modules is, but I generally just expose 1 function to register routes. Currently it's not really possible to do this without specifying the type of the router, which isn't really great. Having a base type solves this problem.

This pull request adds a IHttpRouter interface that implements all of the convenience functions from UrlRouter and also modifies UrlRouter slightly to implement IHttpRouter (I changed the return value of match from void to IHttpRouter).