import { Router } from 'express'
import renderPage from './pages'

const noop = () => {}

const router = Router()

router.get('/', (req, res, next = noop) => {
  res.locals.page = 'index'
  renderPage(req, res, next)
})

router.get('/:page', renderPage)

export default router

@@ -26,16 +26,79 @@
 xpress'%0A
+import %7B isIterable, isString, isFunction %7D from 'magic-types'%0A
 import r
@@ -333,8 +333,936 @@
  router%0A
+%0Aexport const customRoutes =%0A  (app) =%3E %7B%0A    const routes = app.get('routes')%0A%0A    // load host specific router%0A    if (routes) %7B%0A      if (isIterable(routes)) %7B%0A        Object.keys(routes).forEach(%0A          key =%3E %7B%0A            const route = routes%5Bkey%5D%0A            const %7B path, handler, method = 'get' %7D = route%0A%0A            const isValidMethod = %5B'get', 'post'%5D.some(v =%3E v === method)%0A            if (!isValidMethod) %7B%0A              throw new Error(%60Route method of type $%7Bmethod%7D is not valid%60)%0A            %7D%0A%0A            if (!isString(path)) %7B%0A              throw new Error(%60Route needs a path string to work $%7Broute%7D%60)%0A            %7D%0A%0A            if (!isFunction(handler)) %7B%0A              throw new Error(%60Route needs a handler function to work $%7Broute%7D%60)%0A            %7D%0A%0A            app%5Bmethod%5D(path, handler)%0A          %7D%0A        )%0A      %7D%0A      else if (isFunction(routes)) %7B%0A        app.use(routes)%0A      %7D%0A    %7D%0A  %7D%0A

add customRoutes to routes.js