forked from ISBX/isbx-loopback-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot-cms.example.js
More file actions
26 lines (22 loc) · 849 Bytes
/
boot-cms.example.js
File metadata and controls
26 lines (22 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// This file goes in your LoopBack /server/boot/ directory
module.exports = function mountCMS(server) {
var cms;
try {
cms = require('isbx-loopback-cms');
} catch(err) {
console.log(
'Run `npm install isbx-loopback-cms` to enable the ISBX CMS for LoopBack'
);
return;
}
var restApiRoot = server.get('restApiRoot');
var cmsApp = cms(server, { basePath: restApiRoot, modelPath: __dirname + '/../../common/models/', configPath: __dirname + '/../../CMS/config.json' });
server.use('/cms', cmsApp);
server.once('started', function() {
var baseUrl = server.get('url').replace(/\/$/, '');
// express 4.x (loopback 2.x) uses `mountpath`
// express 3.x (loopback 1.x) uses `route`
var cmsPath = cmsApp.mountpath || cmsApp.route;
console.log('Browse your CMS at %s%s', baseUrl, cmsPath);
});
};