@@ -4,27 +4,26 @@ module.exports = function mountLoopBackExplorer(app) {
44 }
55 var explorer ;
66 try {
7- explorer = require ( 'loopback-explorer' ) ;
7+ explorer = require ( 'loopback-component- explorer' ) ;
88 } catch ( err ) {
99 // Print the message only when the app was started via `app.listen()`.
1010 // Do not print any message when the project is used as a component.
1111 app . once ( 'started' , function ( ) {
1212 console . log (
13- 'Run `npm install loopback-explorer` to enable the LoopBack explorer'
13+ 'Run `npm install loopback-component-explorer` to enable ' +
14+ 'the LoopBack explorer'
1415 ) ;
1516 } ) ;
1617 return ;
1718 }
1819
1920 var restApiRoot = app . get ( 'restApiRoot' ) ;
21+ var mountPath = '/explorer' ;
2022
21- var explorerApp = explorer ( app , { basePath : restApiRoot } ) ;
22- app . use ( '/explorer' , explorerApp ) ;
23+ explorer ( app , { basePath : restApiRoot , mountPath } ) ;
2324 app . once ( 'started' , function ( ) {
2425 var baseUrl = app . get ( 'url' ) . replace ( / \/ $ / , '' ) ;
25- // express 4.x (loopback 2.x) uses `mountpath`
26- // express 3.x (loopback 1.x) uses `route`
27- var explorerPath = explorerApp . mountpath || explorerApp . route ;
28- console . log ( 'Browse your REST API at %s%s' , baseUrl , explorerPath ) ;
26+
27+ console . log ( 'Browse your REST API at %s%s' , baseUrl , mountPath ) ;
2928 } ) ;
3029} ;
0 commit comments