├── index.imba ├── README.md ├── test ├── webpack.config.js ├── index.html ├── index.imba ├── server.imba ├── run.imba ├── app.imba ├── index.css └── api.imba ├── LICENSE ├── .gitignore ├── package.json ├── lib ├── util.js ├── Route.js └── index.js ├── src ├── Route.imba └── index.imba └── yarn.lock /index.imba: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # imba-router 2 | Experimental router for Imba 3 | -------------------------------------------------------------------------------- /test/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: "./index.imba", 3 | output: { filename: "./bundle.js" } 4 | }; -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Imba Router 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/index.imba: -------------------------------------------------------------------------------- 1 | 2 | import {Router} from '../src' 3 | import {App} from './app' 4 | 5 | var router = Router.new() 6 | var app = 7 | 8 | # to make sure page does not flash to white 9 | # we wait until the router has finished loading 10 | # until we replace the document with our mounted app 11 | router.onReady do 12 | document:body:innerHTML = '' 13 | Imba.mount app -------------------------------------------------------------------------------- /test/server.imba: -------------------------------------------------------------------------------- 1 | import {App} from './app' 2 | import {Router} from '../src' 3 | 4 | const express = require('express') 5 | const app = express() 6 | 7 | app.use(express.static('./')) 8 | 9 | app.get(/.*/) do |req,res| 10 | var path = req:path 11 | 12 | var router = Router.new(url: path) 13 | var node = 14 | 15 | # blank favicon 16 | 17 | 18 | 19 | # include the app tag in body 20 | 21 | # include the script for our application 22 |