<commit_before>import {config} from 'dotenv';
config();
import './rxjs';
import {Observable as $} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import * as connect from 'connect';
import * as compression from 'compression';
import * as serveStatic from 'serve-static';
import {createServer} from 'http';
import * as socketIo from 'socket.io';
import * as path from 'path';
import * as game from './game';
import {getTime, saveTime, getPlace, getLeaderboard} from './db';
import {emitObservables, observablesFromEvents} from '../shared/socket-util';

const {assign} = Object;

const app = connect();
app.use(compression());
app.use(serveStatic('public'));

const server = createServer(app);

const io = socketIo(server, {serveClient: false});
io.on('connection', client => {
  const {id} = client;
  log('connected', {id});
  client.on('disconnect', () => log('disconnected', {id}));
  client.on('pingcheck', () => client.emit('pongcheck'));
  client.once('start', name => {
    log('start', {id, name});
    if (!name) { return client.disconnect(); }
    name = name.substr(0, 16);
    start(client, name);
  });
});<commit_msg>feat: add maxAge option to static server<commit_after>import {config} from 'dotenv';
config();
import './rxjs';
import {Observable as $} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import * as connect from 'connect';
import * as compression from 'compression';
import * as serveStatic from 'serve-static';
import {createServer} from 'http';
import * as socketIo from 'socket.io';
import * as path from 'path';
import * as game from './game';
import {getTime, saveTime, getPlace, getLeaderboard} from './db';
import {emitObservables, observablesFromEvents} from '../shared/socket-util';

const {assign} = Object;

const app = connect();
app.use(compression());
app.use(serveStatic('public', {maxAge: 3600}));

const server = createServer(app);

const io = socketIo(server, {serveClient: false});
io.on('connection', client => {
  const {id} = client;
  log('connected', {id});
  client.on('disconnect', () => log('disconnected', {id}));
  client.on('pingcheck', () => client.emit('pongcheck'));
  client.once('start', name => {
    log('start', {id, name});
    if (!name) { return client.disconnect(); }
    name = name.substr(0, 16);
    start(client, name);
  });
});
{'fraction_non_alphanumeric': 0.1848991848991849, 'fraction_numerical': 0.00429000429000429, 'mean_word_length': 5.185676392572944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3573702', 'n_tokens_mistral': 734, 'n_tokens_neox': 722, 'n_words': 216}