简体   繁体   中英

Express rest api get all endpoints

I have nodejs app with express framework. If I want to catch all endpoints for a http method, say 'GET', how would I define it. I tried :

app.get('*', ... )

But it doesn't seem to work. I don't want to use 'ALL' , just specific method.

据我了解,您应该使用:

app.get('/*',.......)

try using for get method

app.get('*', function(req, res) { ... });

or use this for all methods

app.get('*', function(req, res) { ... });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM