hswolff/Ghost — pull request #2 by lennerd (2014-05-05 12:45:25+00:00)
Title: Frontend router and controller refactoring

Hey @hswolff,

like I promissed, here a PR with the ideas I had to this.

**Importend refactorings:**

- I added a Router which extends the express Router by adding and retrieving routes by name. That makes it possible to generate pathes in the controller (e.g. when pages are wrong) (see `req.generatePath()`).
- I refactored the frontend controller. This was possible because of the new frontend Router but also because I added a permalink route to the route collection. I thinks it's much cleaner this way, holding routes directly in the router.

**Todos:**

- Tests gone wrong, need to fix it. Add tests for the router.
- Use the router for other places in Ghosts where possible

Sorry for this quick'n'dirty PR. Would clean it up, if we find proper improvements.

I looking forward to your opinions on this.