File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ const authentication = require('./authentication');
77const notFound = require ( './not-found-handler' ) ;
88const rest = require ( './rest' ) ;
99
10- function feathersExpress ( feathersApp ) {
10+ function feathersExpress ( feathersApp , expressApp = express ( ) ) {
1111 if ( ! feathersApp ) {
12- return express ( ) ;
12+ return expressApp ;
1313 }
1414
1515 if ( typeof feathersApp . setup !== 'function' ) {
@@ -20,7 +20,6 @@ function feathersExpress (feathersApp) {
2020 throw new Error ( `@feathersjs/express requires an instance of a Feathers application version 3.x or later (got ${ feathersApp . version || 'unknown' } )` ) ;
2121 }
2222
23- const expressApp = express ( ) ;
2423 // An Uberproto mixin that provides the extended functionality
2524 const mixin = {
2625 use ( location ) {
Original file line number Diff line number Diff line change @@ -29,6 +29,13 @@ describe('@feathersjs/express', () => {
2929 assert . strictEqual ( typeof app , 'function' ) ;
3030 } ) ;
3131
32+ it ( 'allows to use an existing Express instance' , ( ) => {
33+ const expressApp = express ( ) ;
34+ const app = expressify ( feathers ( ) , expressApp ) ;
35+
36+ assert . strictEqual ( app , expressApp ) ;
37+ } ) ;
38+
3239 it ( 'exports `express.rest`' , ( ) => {
3340 assert . ok ( typeof expressify . rest === 'function' ) ;
3441 } ) ;
You can’t perform that action at this time.
0 commit comments