-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
43 lines (31 loc) · 778 Bytes
/
main.js
File metadata and controls
43 lines (31 loc) · 778 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
var Main = exports;
//dependencies
var express = require('express'),
http = require('http'),
sync = require('./sync'),
path = require('path');
Main.init = function(){
console.log('INIT SYNC SERVER');
//create express app
var app = express();
//setup the web server
app.server = http.createServer(app);
//settings
app.configure(function(){
app.disable('x-powered-by');
});
app.set('port', Main.config.port);
//app.set('strict routing', false);
//listen up
app.listen(app.get('port'), function(){
console.log('Readable dir', process.cwd(), Main.config );
});
return app;
}
Main.config = sync.config;
Main.start = function(app,st){
// route to synchronize
sync.route(app,st ? express.static : undefined);
return sync;
};