Routes and URI
Stratox Pilot is a JavaScript router designed for ease of use and flexibility. It employs regular expressions to offer dynamic routing, allowing for both straightforward and complex navigation paths.
A Really Basic Example
// Possible path: #about
router.get('/about', function({ http, services, helper, context }) {
});// Possible path: #about/contact
router.get('/about/contact', function({ http }) {
});Using Regular Expressions
// Possible path: #about/location/stockholm
router.get('/about/location/{[a-z]+}', function({ http }) {
});Binding Router Patterns to a Key
// Possible path: #about/location/stockholm
router.get('/{page:about}/location/{city:[^/]+}', function({ http }) {
// http.vars.page[0] is expected to be "about"
// http.vars.city[0] is expected to be any string value (stockholm, denmark, new-york) from passed URI.
});Combining Pattern with Keywords
Handling Unlimited Nested Paths
Optional URI Paths
Catch Status Errors
Last updated