-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNilex.js
41 lines (30 loc) · 1016 Bytes
/
Nilex.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
var express = require("express");
var bodyParser = require("body-parser");
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
var mountModule = require("./Modules/MountModule");
var errorModule = require("./Modules/ErrorModule");
var nylex = {
start : function start(port) {
app.listen(port);
console.log("Server listening at port: %s", port);
},
mount : function mount(path, controller) {
controller.setApp(this);
mountModule.mount(path, controller, app);
},
before : function before (path, beforeFunction) {
app.all(path, beforeFunction);
},
mountError : function error(errorController) {
errorModule.mountError(errorController, app);
},
throwError : function throwError(errorCode) {
errorModule.throwError(errorCode);
},
static : function set(pathName, folderPath) {
app.use(pathName, express.static(folderPath));
}
}
module.exports = nylex;