Migrating To Sails.js 0.12 - Middleware Migration
I am migrating an old sails.js project which was written in 0.10.5 to 0.12.x. Since the original code was written a long time ago and may have some 'non-conforming' code I decided
Solution 1:
Yes, you can remove the custom middleware. Latest pattern is easier to manage. For starters,
Access-Control-Allow-Origin
can be set inconfig/cors.js
You can use
passport-jwt
in a more sailsy way by making use ofsails-auth
module. And splitting the logic intoservices
, usingpolicies
to manage the flow etc. The problem withsails-auth
is, the module in npm has been published over an year ago. It has several bugs. The GitHub repo though has stable version.
I have made a bare minimum auth server in sails, which you can extend for various passport strategies. The server supports local
, bearer
, JWT
strategies out of the box.
Post a Comment for "Migrating To Sails.js 0.12 - Middleware Migration"