I have an angular site running on a sails.js backend. I am trying to implement the prerender.io service for my site so that my site can be indexed by search engines.
The problem I am running into is that the setup instructions for their node module are specifically for express. Basically they want you to set up this middleware:
app.use(require('prerender-node').set('prerenderToken', 'r8c9lN6JsUMMfpzYNlht'));
Sails doesn't set up middleware this way, but rather through it's policies
(for the most part, anyway).
This question was raised some time ago here, however it seems it was simply added to a list and never actually addressed.
I have also looked at this: How to use custom route middleware with Sails.js? (ExpressJS)
and have attempted implementing the customMiddleware solution, but to no avail.
Any ideas how to set this up in sails?
If you look at this issue: https://github.com/prerender/prerender/issues/12
@talss89 was able to get it working using
config/http.js
: