Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
108 views
in Technique[技术] by (71.8m points)

javascript - Is there anyway to list existing routes in FeathersJS framework?

In Laravel i can use

php artisan route list

To see all routes in my Laravel project .. I am asking for the same behavior but in FeathersJS framework which built on top of ExpressJS.

If not, is there anyway to create that as a custom command using node js to obtain the same behavior ?

Thanks

question from:https://stackoverflow.com/questions/65560010/is-there-anyway-to-list-existing-routes-in-feathersjs-framework

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Usually it is just a list of all folders in src/services but you can also get a dynamic list as shown in the documentation for app.services. This can be quickly turned into a command like this:

// list-services.js
const app = require('./src/app');
const serviceList = Object.keys(app.services);

console.log(serviceList.join('
');

Now you can run this with node list-services


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...