Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Accept a express instance as optional parameter in the feathersExpress. #1419

Closed
TobyMosque opened this issue Jun 26, 2019 · 3 comments · Fixed by #1446
Closed

Comments

@TobyMosque
Copy link

Accept a express instance as optional parameter in the feathersExpress.

Current

// link: https://github.com/feathersjs/feathers/blob/master/packages/express/lib/index.js
// imports
function feathersExpress (feathersApp) {
  if (!feathersApp) {
    return express();
  }

  if (typeof feathersApp.setup !== 'function') {
    throw new Error('@feathersjs/express requires a valid Feathers application instance');
  }

  if (!feathersApp.version || feathersApp.version < '3.0.0') {
    throw new Error(`@feathersjs/express requires an instance of a Feathers application version 3.x or later (got ${feathersApp.version || 'unknown'})`);
  }

  const expressApp = express();
  // do something
}

Proposed

// imports
function feathersExpress (feathersApp, expressApp) {
  if (!feathersApp) {
    return expressApp || express();
  }

  if (typeof feathersApp.setup !== 'function') {
    throw new Error('@feathersjs/express requires a valid Feathers application instance');
  }

  if (!feathersApp.version || feathersApp.version < '3.0.0') {
    throw new Error(`@feathersjs/express requires an instance of a Feathers application version 3.x or later (got ${feathersApp.version || 'unknown'})`);
  }

  expressApp = expressApp || express();
  // do something
}
@MichaelJCole
Copy link

Hi @daffl this is part of the Quasar + Feathers conversation with @nothingismagick. @TobyMosque is on the team and this change is toward integrating the dev experience.

@daffl
Copy link
Member

daffl commented Jul 9, 2019

Sounds good. I'll try and put up a PR for this today.

@daffl
Copy link
Member

daffl commented Jul 10, 2019

Released in v4.0.0-pre.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants