给定控制器函数或路由路径,如何在Express JS中获取完整的路由URL?

给定控制器函数或路由路径,如何在Express JS中获取完整的路由URL?,express,routing,express-router,Express,Routing,Express Router,我正在编写一个expressjs应用程序,需要在给定控制器函数或路由路径的情况下计算路由 例如: 让myUrl=functionToGetOutepath(ThingsController.getThing);//会回来吗https://host/api/v1/things/{id} //或 让myUrl=functionToGetOutepath('/things/{id}');//会回来吗https://host/api/v1/things/{id}在这方面,req.originalUrl

我正在编写一个expressjs应用程序,需要在给定控制器函数或路由路径的情况下计算路由

例如:

让myUrl=functionToGetOutepath(ThingsController.getThing);//会回来吗https://host/api/v1/things/{id}
//或

让myUrl=functionToGetOutepath('/things/{id}');//会回来吗https://host/api/v1/things/{id}
在这方面,
req.originalUrl
有帮助吗?

我想,如果我使用自己的解决方案,这将为我提供一种确定基本URL(主机、根路径等)的方法。但如果可以的话,我希望利用Express。