<commit_before>var WebSocket = require('ws');
var Reply = require('./reply');
var express = require('express');

var err = function (e) {
	if (e) console.log(e);
};

var initWS = function () {
	var ws = new WebSocket('wss://bnw.im/comments/ws');

	ws.on('message', function (message, flags) {
		var reply = new Reply(JSON.parse(message));
		reply.save(err);
	});
	
	ws.on('close', function () {
		setTimeout(initWS, 1000);
	});
};
initWS();

var app = express();

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

app.get('/comments', function (req, res) {
	Reply.find().
	sort({date: -1}).
	limit(20).
	skip(req.param('skip')|0).
	exec(function (e, replies) {
		if (e) return res.status(500).send();
		res.json(replies);
	});
});

app.listen(8000);<commit_msg>Log server status<commit_after>var WebSocket = require('ws');
var Reply = require('./reply');
var express = require('express');

var err = function (e) {
	if (e) console.log(e);
};

var initWS = function () {
	var ws = new WebSocket('wss://bnw.im/comments/ws');

	ws.on('message', function (message, flags) {
		var reply = new Reply(JSON.parse(message));
		reply.save(err);
	});
	
	ws.on('close', function () {
		setTimeout(initWS, 1000);
	});
};
initWS();

var app = express();

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

app.get('/comments', function (req, res) {
	Reply.find().
	sort({date: -1}).
	limit(20).
	skip(req.param('skip')|0).
	exec(function (e, replies) {
		if (e) return res.status(500).send();
		res.json(replies);
	});
});

app.listen(8000);

console.log('Listening ', 8000, ' launched at ', new Date());
{'fraction_non_alphanumeric': 0.2232764073371284, 'fraction_numerical': 0.021505376344086023, 'mean_word_length': 4.344594594594595, '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': '1802576', 'n_tokens_mistral': 619, 'n_tokens_neox': 572, 'n_words': 127}