Simon
Simon

Reputation: 5247

How to mount a Sails.js app as express middleware

I would like to use Sails within a larger express based app. Most node.js MVC frameworks I have worked with you can mount as express middleware. Is this possible with Sails?

I want to do something like:

var express = require('express'),
  app = express();

var mySailsApp = require('./mysailsapp');

app.use(mySailsApp);

Upvotes: 2

Views: 647

Answers (1)

sgress454
sgress454

Reputation: 24948

While there are some active efforts to develop systems that would let Sails be more modularized, there's no way to use a Sails app as Express middleware. Sails works on top of Express, but not the other way around. However, you can use custom Express middleware with Sails--see this answer for an example.

Upvotes: 2

Related Questions