<commit_before>import http from 'http';
import express from 'express';
import promise from 'bluebird';
import mongoose from 'mongoose';
import logger from './service/logger';
import fileRouter from './router/file_router';
import config from '../config.json';

let app = express();

promise.promisifyAll(mongoose);

if(config.mode == 'dev') app.use(express.static('public'));

// register routers
// import qnRouter from './router/qn_router';

let mount = config.path || '/file';

app.use(mount, fileRouter);
// app.use('/qnservice', qnRouter);

// handle 404
app.use((req, res, next) => {
    let err = new Error('Not found.');
    err.status = 404;
    next(err);
});
// handel error
app.use((err, req, res, next) => {
    let statusCode = err.status || 500;
    logger.warning('Request process error: ' + statusCode + ' ' + err.message);
    res.status(statusCode).json(err);
});

// listening
let port = config.port || 4000;
app.listen(port, () => {
    logger.info('Server start and listening on port ' + port);<commit_msg>clear code<commit_after>import http from 'http';
import express from 'express';
import promise from 'bluebird';
import mongoose from 'mongoose';
import logger from './service/logger';
import fileRouter from './router/file_router';
import config from '../config.json';

let app = express();

promise.promisifyAll(mongoose);

if(config.mode == 'dev') app.use(express.static('public'));

// register routers
let mount = config.path || '/file';
app.use(mount, fileRouter);

// handle 404
app.use((req, res, next) => {
    let err = new Error('Not found.');
    err.status = 404;
    next(err);
});
// handel error
app.use((err, req, res, next) => {
    let statusCode = err.status || 500;
    logger.warning('Request process error: ' + statusCode + ' ' + err.message);
    res.status(statusCode).json(err);
});

// listening
let port = config.port || 4000;
app.listen(port, () => {
    logger.info('Server start and listening on port ' + port);
{'fraction_non_alphanumeric': 0.17386883579054396, 'fraction_numerical': 0.013218098627351297, 'mean_word_length': 4.00763358778626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2169417', 'n_tokens_mistral': 639, 'n_tokens_neox': 618, 'n_words': 176}