forked from colmena/colmena
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (25 loc) · 816 Bytes
/
server.js
File metadata and controls
29 lines (25 loc) · 816 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
26
27
28
29
import 'dotenv/config'
import loopback from 'loopback'
import boot from 'loopback-boot'
const app = module.exports = loopback()
// start the web server
app.start = () => app.listen(() => {
app.emit('started')
const baseUrl = app.get('url').replace(/\/$/, '')
console.log('Web server listening at: %s', baseUrl)
if (app.get('loopback-component-explorer')) {
const explorerPath = app.get('loopback-component-explorer').mountPath
console.log('Browse your REST API at %s%s', baseUrl, explorerPath)
}
})
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname, (err) => {
if (err) {
throw err
}
// start the server if `$ node server.js`
if (require.main === module) {
app.start()
}
})