WebSocket server + Search index + indexable content parser

This commit is contained in:
NGPixel
2016-09-05 00:39:59 -04:00
parent 528fab6c87
commit 7945d024ad
30 changed files with 488 additions and 107 deletions

View File

@@ -10,7 +10,18 @@ global.ROOTPATH = __dirname;
// Load global modules
// ----------------------------------------
var _isDebug = process.env.NODE_ENV === 'development';
global.winston = require('winston');
winston.remove(winston.transports.Console)
winston.add(winston.transports.Console, {
level: (_isDebug) ? 'info' : 'warn',
prettyPrint: true,
colorize: true,
silent: false,
timestamp: true
});
winston.info('[SERVER] Requarks Wiki is initializing...');
var appconfig = require('./models/config')('./config.yml');
@@ -161,8 +172,6 @@ app.use(function(err, req, res, next) {
// Start HTTP server
// ----------------------------------------
winston.info('[SERVER] Requarks Wiki has initialized successfully.');
winston.info('[SERVER] Starting HTTP server on port ' + appconfig.port + '...');
app.set('port', appconfig.port);
@@ -193,12 +202,17 @@ server.on('listening', () => {
});
// ----------------------------------------
// Start Agents
// Start child processes
// ----------------------------------------
var fork = require('child_process').fork;
var bgAgent = fork('agent.js');
var fork = require('child_process').fork,
libInternalAuth = require('./lib/internalAuth'),
internalAuthKey = libInternalAuth.generateKey();
var wsSrv = fork('ws-server.js', [internalAuthKey]),
bgAgent = fork('agent.js', [internalAuthKey]);
process.on('exit', (code) => {
wsSrv.disconnect();
bgAgent.disconnect();
});