brutaljs
Version:
BrutalJS ========
35 lines (28 loc) • 838 B
text/coffeescript
_ = require('lodash')
path = require('path')
riot = require('riot')
glob = require("glob")
router = require("riot-router")
AuthService = require('./services/auth.coffee')
require('./components/**/*', {mode: 'expand'})
riot.mount('*')
securityFilter = (req, res, next) ->
AuthService.ping(next, () ->
riot.route('/login')
)
Route = router.Route
DefaultRoute = router.DefaultRoute
NotFoundRoute = router.NotFoundRoute
RedirectRoute = router.RedirectRoute
router.use(securityFilter)
router.routes([
new DefaultRoute({tag: 'app'})
new Route({tag: 'app'}).routes([
new DefaultRoute({tag: 'landing'})
new Route({path:'/list/:modelName', tag: 'list'})
new Route({path:'/edit/:modelName/:itemId', tag: 'edit'})
new Route({path:'/new/:modelName', tag: 'edit'})
])
new Route({tag: 'login'})
])
router.start()