<commit_before>// modules =================================================

var express        = require('express'),
    app            = express(),
    bodyParser     = require('body-parser'),
    methodOverride = require('method-override'),
    MediaTasks     = require('./api/controllers/tasks');

// configuration ===========================================

/* Port */
var port = process.env.PORT || 8080;

/* API Parsing */
app.use(bodyParser.json());
app.use(bodyParser.json({type: 'application/vnd.api+json'}));
app.use(bodyParser.urlencoded({extended: true}));
app.use(methodOverride('X-HTTP-Method-Override'));

/* Assets */
app.use(express.static(__dirname + '/public'));

// routes ==================================================

require('./api/routes')(app);

// tasks ===================================================

MediaTasks.watchDirectory(process.env.MEDIA_DIR || __dirname + '/public/media');

// start app ===============================================

app.listen(port);
console.log('Listening on port ' + port);
exports = module.exports = app;<commit_msg>Determining media directory dynamically based on production or development environment<commit_after>// modules =================================================

var express        = require('express'),
    app            = express(),
    bodyParser     = require('body-parser'),
    methodOverride = require('method-override'),
    MediaTasks     = require('./api/controllers/tasks'),
    mediaDir;

// configuration ===========================================

/* Port */
var port = process.env.PORT || 8080;

/* API Parsing */
app.use(bodyParser.json());
app.use(bodyParser.json({type: 'application/vnd.api+json'}));
app.use(bodyParser.urlencoded({extended: true}));
app.use(methodOverride('X-HTTP-Method-Override'));

/* Assets */
app.use(express.static(__dirname + '/public'));

// routes ==================================================

require('./api/routes')(app);

// tasks ===================================================

mediaDir = (process.env.APP_DIR) ? process.env.APP_DIR + '/media' : __dirname + '/public/media';
MediaTasks.watchDirectory(mediaDir);

// start app ===============================================

app.listen(port);
console.log('Listening on port ' + port);
exports = module.exports = app;
{'fraction_non_alphanumeric': 0.34788245462402767, 'fraction_numerical': 0.003457216940363008, 'mean_word_length': 5.108179419525066, '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': '4238339', 'n_tokens_mistral': 610, 'n_tokens_neox': 582, 'n_words': 105}