Reputation: 798
In express code:
var kue = require('kue');
var express = require('express');
var ui = require('kue-ui');
var app = express();
app.use('/api', kue.app);
app.use('/kue', ui.app);
I can access: http://localhost:1337/kue
and http://localhost:1337/api
just fine.
I tried to move this into my sails hook:
var kue = require('kue');
var ui = require('ui');
module.exports = function galaxyKueSyncHook(sails) {
return {
routes: {
before: {
'get /kue': ui.app,
'get /api': kue.app
}
}
};
}
It doesn't work. I get a blank pages when access the same URLs.
How do properly get this to work in sails?
Additionally, I was able to get express code to work in config/http.js
with
module.exports.http = {
customMiddleware: function (app) {
app.use(...);
But, I really want the function to be added in an installable hook.
Upvotes: 0
Views: 154
Reputation: 1682
You can use express like:
var app = sails.hooks.http.app;
app.use('/api', kue.app);
Upvotes: 1