-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (37 loc) · 1.1 KB
/
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
49
50
51
52
53
/*
* Petite
*
*/
// Primary app object
app = {};
// Lib object (where the meat of the application lives)
app.lib = {};
// Configuration
app.lib.config = require('./lib/config');
// Exception handling
app.lib.exception = require('./lib/exception');
// Logging
app.lib.log = require('./lib/log');
// Http Server
app.lib.server = require('./lib/server');
// Request handlers
app.lib.req = require('./lib/req');
// Response handlers
app.lib.res = require('./lib/res');
// Lib
app.lib.util = require('./lib/util');
// Controller
app.lib.controllers = require('./lib/controllers');
// Regulator
app.lib.regulator = require('./lib/regulator');
// Expose the API functions as top-level keys (aliases) within the app object
app.requireUrl = app.lib.req.setRequiredUrl;
app.disallowUrl = app.lib.req.setDisallowedUrl;
app.requireHeader = app.lib.req.setRequiredHeader;
app.addController = app.lib.controllers.add;
app.setConfig = app.lib.config.setConfigOption;
app.start = app.lib.regulator.start;
app.stop = app.lib.regulator.stop;
app.config = app.lib.config.currentConfig;
// Export the module
module.exports = app;