<commit_before>/*jshint node:true*/
"use strict";

var connect = require('connect');
var mongo = require('mongoskin');
var uuid = require('node-uuid');
var lessMiddleware = require('less-middleware');
var browserify = require('browserify');

module.exports = function(server) {
	server.init = function(options) {
		console.log('mongo' , options.mongodb);
		var database = mongo.db(options.mongodb);
		var api = new server.API(database);
		database.bind('users');
		database.bind('collections');
		database.bind('dares');
		database.bind('instances');

		database.open(function(err, db) {
			if (err) {
				console.log('MongoDB error:', err);
				return;
			}

			server.dares(database);

			var app = connect()
				.use(connect.logger('tiny'))
				.use('/api', api.getMiddleware())
				.use(lessMiddleware(options.less))
				.use(browserify(options.browserify))
				.use('', function(req, res, next) {
					if(req.url.indexOf('/home') === 0 || req.url.indexOf('/full') === 0) req.url = '/';
					next();
				})
				.use(connect['static'](options.assets))
				.listen(options.port);
		});
	};
};
<commit_msg>Removed logging of requests for heroku<commit_after>/*jshint node:true*/
"use strict";

var connect = require('connect');
var mongo = require('mongoskin');
var uuid = require('node-uuid');
var lessMiddleware = require('less-middleware');
var browserify = require('browserify');

module.exports = function(server) {
	server.init = function(options) {
		console.log('mongo' , options.mongodb);
		var database = mongo.db(options.mongodb);
		var api = new server.API(database);
		database.bind('users');
		database.bind('collections');
		database.bind('dares');
		database.bind('instances');

		database.open(function(err, db) {
			if (err) {
				console.log('MongoDB error:', err);
				return;
			}

			server.dares(database);

			var app = connect()
				.use(connect.logger('tiny'));
			
			if (options.logs.requests) app.use('/api', api.getMiddleware());

				app.use(lessMiddleware(options.less))
				.use(browserify(options.browserify))
				.use('', function(req, res, next) {
					if(req.url.indexOf('/home') === 0 || req.url.indexOf('/full') === 0) req.url = '/';
					next();
				})
				.use(connect['static'](options.assets))
				.listen(options.port);
		});
	};
};

{'fraction_non_alphanumeric': 0.19490781387181738, 'fraction_numerical': 0.001755926251097454, 'mean_word_length': 4.064444444444445, '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': '5964596', 'n_tokens_mistral': 872, 'n_tokens_neox': 750, 'n_words': 137}