<commit_before>import "reflect-metadata";
import { Container } from 'inversify';
import { interfaces as IExpressUtils, InversifyExpressServer, TYPE } from 'inversify-express-utils';
import * as bodyParser from 'body-parser';
import * as jayson from 'jayson';

import Song from './api/controllers/Song';
import { TYPES } from './Types';
import config from './config';
import AudioSource from './api/services/media_providers/AudioSource';
import AudioFactory from './api/services/media_providers/AudioFactory';
import DiskSource from './api/services/media_providers/disk/DiskSource';
import DiskFactory from './api/services/media_providers/disk/DiskFactory';

let container = new Container();

container.bind<IExpressUtils.Controller>(TYPE.Controller).to(Song);
container.bind<AudioSource>(TYPES.AudioSource).to(DiskSource);
container.bind<AudioFactory>(TYPES.AudioFactory).to(DiskFactory);
container.bind<any>(TYPES.Config).toConstantValue(config);

let songController = container.get<Song>(TYPE.Controller);

let RPCServer = jayson.server({
    getSong: (args: any, cb: Function) => songController.getSong(args, cb)
});

let ExpressServer = new InversifyExpressServer(container);

ExpressServer
    .setConfig((app) => {
        app.use(bodyParser.json())
        app.use(RPCServer.middleware())
    })
    .build()
    .listen(config.webServer.port, config.webServer.bind_address, () => {
        console.log('Now listening on ' + config.webServer.bind_address + ':' + config.webServer.port);
    });<commit_msg>Socket.IO<commit_after>import "reflect-metadata";
import { Container } from 'inversify';
import { interfaces as IExpressUtils, InversifyExpressServer, TYPE } from 'inversify-express-utils';
import * as bodyParser from 'body-parser';
import * as jayson from 'jayson';
import * as socket from 'socket.io';

import Song from './api/controllers/Song';
import { TYPES } from './Types';
import config from './config';
import AudioSource from './api/services/media_providers/AudioSource';
import AudioFactory from './api/services/media_providers/AudioFactory';
import DiskSource from './api/services/media_providers/disk/DiskSource';
import DiskFactory from './api/services/media_providers/disk/DiskFactory';

let container = new Container();

container.bind<IExpressUtils.Controller>(TYPE.Controller).to(Song);
container.bind<AudioSource>(TYPES.AudioSource).to(DiskSource);
container.bind<AudioFactory>(TYPES.AudioFactory).to(DiskFactory);
container.bind<any>(TYPES.Config).toConstantValue(config);

let songController = container.get<Song>(TYPE.Controller);
let ExpressServer = new InversifyExpressServer(container);

/////////////////////////////////////////////////////////////////////
/// Server Bootstrapping
/////////////////////////////////////////////////////////////////////

//Spin up an RPC server
let RPCServer = jayson.server({
    getSong: (args: any, cb: Function) => songController.getSong(args, cb)
});

//Bring up the express HTTP server
ExpressServer
    .setConfig((app) => {
        app.use(bodyParser.json())
        app.use(RPCServer.middleware())
    })
    .build()
    .listen(config.webServer.port, config.webServer.bind_address, () => {
        console.log('Now listening on ' + config.webServer.bind_address + ':' + config.webServer.port);
    });

//Bootstrap our socket.io server
socket(config.webServer.port);
{'fraction_non_alphanumeric': 0.17592592592592593, 'fraction_numerical': 0.0, 'mean_word_length': 4.128637059724349, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '1719411', 'n_tokens_mistral': 958, 'n_tokens_neox': 941, 'n_words': 201}