<commit_before>var http = require('http');
var express = require('express');
var sockjs = require('sockjs');
var Transactor = require('transactor');
var esCommand = require('es_command');
var EtherSheetService = require('./ethersheet').EtherSheetService;

var ES_CLIENT_PATH= __dirname + '/../node_modules/es_client';
var LAYOUT_PATH = __dirname + '/layouts';


exports.createServer = function(config){


  /***********************************************
  * EtherSheet HTTP Server
  ***********************************************/
  var app = express();
  var http_server = http.createServer(app);

  // Server Settings
  app.set('views',LAYOUT_PATH);
  app.use(express.logger({ format: ':method :url' }));
  app.use('/es_client',express.static(ES_CLIENT_PATH));

  /***********************************************
  * EtherSheet DB Client 
  ***********************************************/
  var es = new EtherSheetService(config);

  // listen after setup
  es.onConnect(function(err){
    if(err) throw err;
    http_server.listen(config.port, config.host, function(){
      console.log('ethersheet is listening over http on port ' + config.port);
    });
  });


  /**********************************************
  * HTTP Routes
  *********************************************/
  //index
  app.get('/', function(req,res){
    res.render('index.ejs');
  });

  //load up the sheet
  app.get('/s/:sheetid', function(req,res){
    res.render('sheet.ejs',{
      sheet_id:req.params.sheetid
    });
  });


  /***********************************************
  * PubSub Server 
  ***********************************************/
  var pub_server = new Transactor(); 

  pub_server.onTransaction(function(channel,data,cb){
    var c = new Command(data);
    var model = es.getModel(c.getDataType(),c.getDataId());
    c.execute(model,function(err,msg){
      cb(err,Command.serialize(msg));
    });
  });

  /***********************************************
  * Websocket Server
  ***********************************************/
  var ws_server = sockjs.createServer();

  ws_server.installHandlers(http_server,{prefix:'.*/pubsub'});
  
  ws_server.on('connection', function(socket){
    var channel = socket.pathname.split('/')[1];
    pub_server.addSocket(channel,socket);
  });

  return http_server;
}
<commit_msg>temporarily make server pass through messages only<commit_after>var http = require('http');
var express = require('express');
var sockjs = require('sockjs');
var Transactor = require('transactor');
var Command = require('es_command');
var EtherSheetService = require('./ethersheet').EtherSheetService;

var ES_CLIENT_PATH= __dirname + '/../node_modules/es_client';
var LAYOUT_PATH = __dirname + '/layouts';


exports.createServer = function(config){


  /***********************************************
  * EtherSheet HTTP Server
  ***********************************************/
  var app = express();
  var http_server = http.createServer(app);

  // Server Settings
  app.set('views',LAYOUT_PATH);
  app.use(express.logger({ format: ':method :url' }));
  app.use('/es_client',express.static(ES_CLIENT_PATH));

  /***********************************************
  * EtherSheet DB Client 
  ***********************************************/
  var es = new EtherSheetService(config);

  // listen after setup
  es.onConnect(function(err){
    if(err) throw err;
    http_server.listen(config.port, config.host, function(){
      console.log('ethersheet is listening over http on port ' + config.port);
    });
  });


  /**********************************************
  * HTTP Routes
  *********************************************/
  //index
  app.get('/', function(req,res){
    res.render('index.ejs');
  });

  //load up the sheet
  app.get('/s/:sheetid', function(req,res){
    res.render('sheet.ejs',{
      sheet_id:req.params.sheetid
    });
  });


  /***********************************************
  * PubSub Server 
  ***********************************************/
  var pub_server = new Transactor(); 

  pub_server.onTransaction(function(channel,data,cb){
    var c = new Command(data);
    return cb(null,Command.serialize(c.getMessage()));

    var model = es.getModel(c.getDataType(),c.getDataId());
    c.execute(model,function(err,msg){
      cb(err,Command.serialize(msg));
    });
  });

  /***********************************************
  * Websocket Server
  ***********************************************/
  var ws_server = sockjs.createServer();

  ws_server.installHandlers(http_server,{prefix:'.*/pubsub'});
  
  ws_server.on('connection', function(socket){
    var channel = socket.pathname.split('/')[1];
    pub_server.addSocket(channel,socket);
  });

  return http_server;
}

{'fraction_non_alphanumeric': 0.32804903825829634, 'fraction_numerical': 0.0004227436060029592, 'mean_word_length': 4.870967741935484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4388234', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1323, 'n_words': 236}