-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
67 lines (53 loc) · 1.97 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
// =============================================================================
//
// Copyright 2013 Neticle Portugal
// http://www.github.com/neticle/nitrous-nodejs-framework
//
// This file is part of "Nitrous/NodeJS", hereafter referred to as "Nitrous".
//
// "Nitrous" is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// "Nitrous" is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
// A PARTICULAR PURPOSE. See theGNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with
// "Nitrous". If not, see <http://www.gnu.org/licenses/>.
//
// =============================================================================
// Load the Nitrous bootstrap file
require('./nitrous/nitrous.js');
exec = require('child_process').exec;
crypto = require('crypto');
fs = require('fs');
//add underscore module, and make accessible via global var
underscore = require("underscore");
_ = underscore;
//override console.log
var oldLog = console.log;
//hide console messages
console.log = console.debug = function() {};
console.debug = function(msg) {
oldLog.apply(console, arguments);
};
// Declare the required modules
$.using(
'system.http.server',
'system.restful.service'
);
// Create a new HttpServer to listen, and the service
var server = $.httpServer.create(1337);
var service = $.restfulService.create(server);
// Define the temporary assets directories
server.setSessionDirectory('application.assets.sessions');
server.setUploadDirectory('application.assets.uploads');
// Register the service as the 'app' module and start listening
$.app = service;
server.start();
// Load all application modules
$.using(
'application.modules.matlab'
);