-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
48 lines (38 loc) · 950 Bytes
/
index.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const Sevr = require('sevr')
const SevrCli = require('sevr-cli')
const SevrPerm = require('sevr-perm')
const WebServer = require('./web')
const config = require('./config')
/**
* Application plugin class
*
* All custom application intialization and logic
* should happen within this class
*
* @class App
*/
class App {
constructor(sevr) {
this.sevr = sevr
}
willRun() {
this.sevr.logger.info('Enabling authentication...')
return this.sevr.authentication.enable(this.sevr.collections.users)
}
run() {
this.sevr.startServer()
this.sevr.logger.verbose('Application running...')
}
}
// Create a new Sevr instance
const sevr = new Sevr(config)
// Attach the remote CLI plugin
sevr.attach(SevrCli)
// Attach the web server
sevr.attach(WebServer)
// Attach the permissions plugin
sevr.attach(SevrPerm, config.permissions)
// Attach the application plugin
sevr.attach(App)
sevr.start()
module.exports = sevr