how to create a global route prefix in sails?

前端 未结 3 2117
执念已碎
执念已碎 2021-01-04 10:25

I just recently started using sails and nodejs.

I was wondering, is there an easy way to create a global prefix using the configuration available in Sails? Or would

3条回答
  •  不知归路
    2021-01-04 10:43

    As of version 0.12.x, this is located in config/blueprints.js on line 100. The same rules apply as previously mentioned. The prefix only applies to the blueprint autoroutes, not manually create routes in config/routes.js.

    /*************************************************************************** * * * An optional mount path for all blueprint routes on a controller, * * including 'rest', 'actions', and 'shortcuts'. This allows you to take * * advantage of blueprint routing, even if you need to namespace your API * * methods. * * * * (NOTE: This only applies to blueprint autoroutes, not manual routes from * * 'sails.config.routes') * * * ***************************************************************************/ // prefix: '', <----- line 100 in config/blueprints.js

提交回复
热议问题