<commit_before>
/**
 * Module dependencies.
 */

var express = require('express');
var routes = require('./routes');
var http = require('http');
var path = require('path');

var app = express();

var preciosa = require('../preciosa');
preciosa.initialize();
console.log('Loading data...');
preciosa.loadMarcasFabricantes();
preciosa.loadCategorias();
preciosa.loadProductos();
preciosa.loadCiudades();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/', routes.index);

app.get('/api/analyze', function (req, res) {
    console.dir(req.param('q'));
    res.send(preciosa.analyze(req.param('q')));
});

app.get('/api/search', function (req, res) {
    console.dir(req.param('q'));
    res.send(preciosa.search(req.param('q')));
});

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});<commit_msg>preciosa server loads remote brands<commit_after>
/**
 * Module dependencies.
 */

var express = require('express');
var routes = require('./routes');
var http = require('http');
var path = require('path');

var app = express();

var preciosa = require('../preciosa');
preciosa.initialize();
console.log('Loading data...');
preciosa.loadCategorias();
preciosa.loadProductos();
preciosa.loadCiudades();
preciosa.loadMarcasFabricantes();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/', routes.index);

app.get('/api/analyze', function (req, res) {
    console.dir(req.param('q'));
    res.send(preciosa.analyze(req.param('q')));
});

app.get('/api/search', function (req, res) {
    console.dir(req.param('q'));
    res.send(preciosa.search(req.param('q')));
});

console.log("Loading remote data...");

preciosa.loadRemoteMarcas(function (err, data) {
    if (err)
        console.log(err);
        
    preciosa.defineMarcasFabricantes();
    
    http.createServer(app).listen(app.get('port'), function(){
      console.log('Express server listening on port ' + app.get('port'));
    });
});
{'fraction_non_alphanumeric': 0.22002820874471085, 'fraction_numerical': 0.0028208744710860366, 'mean_word_length': 5.180827886710239, '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': '3372769', 'n_tokens_mistral': 967, 'n_tokens_neox': 949, 'n_words': 164}