
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mithril-router
Advanced tools
Django style router for Mithril.js
npm install mithril-routerNode.js / Browserify
// Include mithril
var m = require('mithril')
// Pass mithril to the router.
// Only required to overload once, subsequent overloads will
// return the same instance
require('mithril-router')(m)
Browser
<script src="path/to/mithril.js" type="text/javascript"></script>
<script src="path/to/mithril.router.js" type="text/javascript"></script>
Router allowing creation of Single-Page-Applications (SPA) with a DRY mechanism (identification classified as namespaces) to prevent hard-coded URLs.
m.route(): returns current routem.route(element:DOMElement): bind elements while abstracting away route modem.route(namespace|route(, parameters:Object)): programmatic redirect w/ argumentsm.route(namespace|route(, replaceHistory:Boolean)): programmatic redirect w/ replacing history entrym.route(namespace|route(, parameters:Object, replaceHistory:Boolean)): programmatic redirect w/ arguments and replacing history entrym.route(rootElement:DOMElement, routes:Object): configure app routingm.route(rootElement:DOMElement, rootRoute:String, routes:Object): configure app routing (mithril default router style)To define routing specify a host DOM element, and routes with a root route. Should no root route be specified, the first route is chosen.
New
m.route(document.body, {
"/": { controller: home, namespace: "index", root: true },
"/login": { controller: login, namespace: "login" },
"/dashboard": { controller: dashboard, namespace: "dashboard" }
})
Classic
m.route(document.body, "/", {
"/": { controller: home, namespace: "index" },
"/login": { controller: login, namespace: "login" },
"/dashboard": { controller: dashboard, namespace: "dashboard" }
})
Redirect user to specified route, or route namespace with given arguments.
Sugar for m.route(namespace|path(, args))
Generate path using specified identifier (route namespace) and path arguments.
m.reverse(namespace(, options)): takes specified route namespace and options and generates path.params: Object Route parameters, named and non-named.
query: String | Object Querystring
prefix: String | Boolean Mode, when true prepends the mode char to the route,
when defined as a string the string is prepended instead.
Useful for when you are not using config: m.route
// user => /user/
m.reverse('user')
// user => /user/:id => /user/23
m.reverse('user', { params: { id: 23 }})
// user => /user/:id => /user/23?include=profile
m.reverse('user', { params: { id: 23 }, query: { include: 'profile' }})
// user => /user/:id => #/user/23?include=profile
m.route.mode = 'hash'
m.reverse('user', { prefix: true, params: { id: 23 }, query: { include: 'profile' }})
// user => /user/:id => /api/user/23?include=profile
m.reverse('user', { prefix: '/api', params: { id: 23 }, query: { include: 'profile' }})
Licensed under The MIT License.
FAQs
Django style router for Mithril.js
We found that mithril-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.