feathersjs-ecosystem / feathers-mongoose

Easily create a Mongoose Service for Feathersjs.
MIT License
189 stars 96 forks source link

Routing Feathers service with express #108

Closed RaghavendhraK closed 8 years ago

RaghavendhraK commented 8 years ago

Can we use the feathers-mongoose service directly as a middleware to the express app?

'use strict';
const express = require('express');
const app = express();
const service = require('feathers-mongoose');
const account = require('./account-model');//this is a mongoose model

 const options = {
    Model: account,
    paginate: {
      default: 1000,
      max: 1000
    }
  };

  app.use('/seal-api/users', service(options));
};
marshallswain commented 8 years ago

Nope. https://github.com/feathersjs/feathers/blob/master/src/application.js#L61

Feathers is the little wrapper around express that enables the use of service, so instead of requiring express, change it to feathers and you've got a combo that works.