Closed JaneJeon closed 5 years ago
Hi @JaneJeon, you can achieve this by passing your own routerFactory
and therefore having control of the router instance. Please see the example below:
let prettyPrint
const router = require('find-my-way')
const routerFactory = (options) => {
const instance = router({
ignoreTrailingSlash: options.ignoreTrailingSlash || false,
allowUnsafeRegex: options.allowUnsafeRegex || false,
maxParamLength: options.maxParamLength || 100,
defaultRoute: options.defaultRoute || ((req, res) => res.send(404))
})
prettyPrint = () => instance.prettyPrint()
return instance
}
const restana = require('restana')
const app = restana({
routerFactory
})
...
You might also be interested on the
routes()
method in restana. Not that fancy asprettyPrint
, but I guess will give you the same information.
Regards
Hi, is there any way to expose the router generated from restana?
I'm mainly interested in doing a
router.prettyPrint()
as supported by find-my-way, but I couldn't find any property/method of the service that returns the router.