js

module.exports = {
    view: function() {
        // TODO implement view
    }
}
</code></pre>
<p>Then we can <code>require</code> this new module from <code>src/index.js</code></p>
<pre><code class="lang-javascript">// src/index.js
var m = require(&quot;mithril&quot;)

var UserList = require(&quot;./views/UserList&quot;)
var UserForm = require(&quot;./views/UserForm&quot;)

m.route(document.body, &quot;/list&quot;, {
    &quot;/list&quot;: UserList
})
</code></pre>
<p>And finally, we can create a route