Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
111 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 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...