Router Question


#1

It should be possible to specify a root url. For example this is the base URL of an app:

www.example.com/admin

where all the underlying pages are off this root? What would a sample routes array look like?

this almost works but it just looks bad

var routes = [
{
path: ‘/’,
url: ‘/admin/index.html’,
name: ‘home’,
routes: [
{ path: ‘/drivers/’, url: ‘/admin/drivers/drivers.html’,
routes: [
{ path: ‘:page/’, url: ‘/admin/drivers/{{page}}.html’ }
]
},
{ path: ‘/pages/’, url: ‘./pages/index.html’,
routes: [
{ path: ‘:page/’, url: ‘./pages/{{page}}.html’ }
]
}
]
},
{ path: ‘/admin/’, url: ‘/admin/index.html’ },
{ path: ‘/login/’, url: ‘./pages/login.html’ },
{ path: ‘(.*)’, url: ‘./pages/404.html’ }
];


#2

If you use pushState then you need to specify absolute paths like you do. Otherwise, for url it can be relative path, e.g. url: ./index.html