<commit_before>// CREATE HTTP SERVER AND PROXY

var app     = require('express')();
var proxy   = require('http-proxy').createProxyServer({});

// LOAD CONFIGURATION

app.use(require('morgan')('dev'));
app.use(require('compression')());

// Configure routes

app.use('/app',   require('serve-static')(__dirname + '/app_build'));
app.use('/app',   require('serve-static')(__dirname + '/app'));
app.all('/app/*', function(req, res) { res.status(404).send(); } );
app.all('/api/*', function(req, res) { proxy.web(req, res, { target: 'https://api.cbd.int:443', secure: false } ); } );

// FOR DEV:
// app.all('/*', function(req, res) { proxy.web(req, res, { target: 'https://bch.cbd.int:443', secure: false } ); } );

// START HTTP SERVER

app.listen(process.env.PORT || 2000, '0.0.0.0', function(){
    console.log('Server listening on %j', this.address());
});

// Handle proxy errors ignore

proxy.on('error', function (e,req, res) {
    console.error('proxy error:', e);
    res.status(502).send();
});

process.on('SIGTERM', ()=>process.exit());<commit_msg>Update server code<commit_after>'use strict'; // jshint browser: false, node: true, esnext: true
// CREATE HTTP SERVER AND PROXY
var app     = require('express')();
var proxy   = require('http-proxy').createProxyServer({});

app.use(require('morgan')('dev'));

// Configure routes

app.use('/app',   require('serve-static')(__dirname + '/app'));
app.all('/app/*', (req, res) => res.status(404).send());
app.all('/api/*', (req, res) => proxy.web(req, res, { target: 'https://api.cbd.int:443', secure: false } ));

// FOR DEV:
// app.all('/*', function(req, res) { proxy.web(req, res, { target: 'https://bch.cbd.int:443', secure: false } ); } );

// START HTTP SERVER

app.listen(process.env.PORT || 2000, '0.0.0.0', function(){
    console.log('Server listening on %j', this.address());
});

// Handle proxy errors ignore

proxy.on('error', function (err, req, res) {
    console.error('proxy error:', err);
    res.status(502).send();
});

process.on('SIGTERM', ()=>process.exit());
{'fraction_non_alphanumeric': 0.2426470588235294, 'fraction_numerical': 0.0196078431372549, 'mean_word_length': 4.328981723237598, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2386407', 'n_tokens_mistral': 730, 'n_tokens_neox': 706, 'n_words': 152}