简体   繁体   中英

Using alias for endpoints with Node and Sails.JS?

Is there a way to make aliases for endpoints in Node?

I have a current endpoint like the following:

sails.router.bind('/current_url/items/:itemId/', itemController.getItem, 'get', {});

A different endpoint is needed that will give the same response. Do we have to create a new route like this? :

sails.router.bind('/new_url/items/:itemId/', itemController.getItem, 'get', {});

Or is there a way to make aliases referring to the previous one?

回顾这个问题,如果需要 2 个不同的端点以相同的方法调用,节点中更清晰、更易于阅读的解决方案是同时编写它们。

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