Skip to content Skip to sidebar Skip to footer

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 in config/cors.js

  • You can use passport-jwt in a more sailsy way by making use of sails-auth module. And splitting the logic into services, using policies to manage the flow etc. The problem with sails-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.

Sails Auth Server

Post a Comment for "Migrating To Sails.js 0.12 - Middleware Migration"