How to use callback array as handler for Sails.js route?

When using Express, you can connect a callback array to the following route:

app.get('/path', thisIsAnArrayOfFunctions);

And then, when accessing http://route_to_server/path, each function inside is thisIsAnArrayOfFunctionscalled.

Exactly how does this routing behavior work in express? is it just iterating through thisIsAnArrayOfFunctions, passing arguments req, resand next?

Is it possible to achieve a simple implementation in Sails for this?

I know this works if I attach routing as express middleware, but I want to know if there is a solution using the Sails controller structure (version 0.9.8).

Thanks in advance.

0
source share
1

Sails-y policies. , . , (, -, ), , , next . , ( ).

.

+1

Source: https://habr.com/ru/post/1530098/


All Articles