如何获取 adonis jakefile 中的所有路由?
How to get all the routes in an adonis jakefile?
我正在尝试在adonis 框架中编写一个jakefile,它可以遍历routes.js 文件中定义的所有路由。
我不确定命令 adonis route:list 是否可以在 jakefile 本身中以任何方式使用。
您可以 运行 adonis route:list
在您的 Jakefile 中使用 jake.exec
或 jake.createExec
var ex = jake.createExec(['adonis', 'route:list']);
ex.addListener('stdout', (msg, code) => console.log(msg));
jake.exec
文档:https://jakejs.com/#running-shell-commands-jake-exec-and-jake-createexec-
route:list
命令在https://github.com/adonisjs/adonis-cli/blob/develop/src/Commands/RouteList/index.js中定义。浏览此文件可以帮助您了解它是如何实现此操作的。
我正在尝试在adonis 框架中编写一个jakefile,它可以遍历routes.js 文件中定义的所有路由。
我不确定命令 adonis route:list 是否可以在 jakefile 本身中以任何方式使用。
您可以 运行 adonis route:list
在您的 Jakefile 中使用 jake.exec
或 jake.createExec
var ex = jake.createExec(['adonis', 'route:list']);
ex.addListener('stdout', (msg, code) => console.log(msg));
jake.exec
文档:https://jakejs.com/#running-shell-commands-jake-exec-and-jake-createexec-
route:list
命令在https://github.com/adonisjs/adonis-cli/blob/develop/src/Commands/RouteList/index.js中定义。浏览此文件可以帮助您了解它是如何实现此操作的。