<commit_before>import express from 'express';
import renderToHTML from 'vdom-to-html';
import { model } from './model';
import { view } from './view';
import { User } from './user';
import { State } from './state';

export default function main() {
  const app = express();
  app.use((req: any, res: any, next: any) => {
    if (req.path.match(/^\/(?:images|scripts|styles)/)) {
      return next();
    }
    model(req.path)
      .then(state => {
        const vtree = view(state, true);
        const html = renderToHTML(vtree);
        res.send(html);
      }, (error: Error) => {
        res.send(error.message);
      });
  });
  app.use(express.static(__dirname + '/../dist/'));
  app.listen(3000);
}<commit_msg>reorder middleware<commit_after>import express from 'express';
import renderToHTML from 'vdom-to-html';
import { model } from './model';
import { view } from './view';
import { User } from './user';
import { State } from './state';

export default function main() {
  const app = express();
  app.use(express.static(__dirname + '/../dist/'));
  app.use((req: any, res: any) => {
    model(req.path)
      .then(state => {
        const vtree = view(state, true);
        const html = renderToHTML(vtree);
        res.send(html);
      }, (error: Error) => {
        res.send(error.message);
      });
  });
  app.listen(3000);
}
{'fraction_non_alphanumeric': 0.1900519673348181, 'fraction_numerical': 0.005939123979213066, 'mean_word_length': 2.8079096045197742, '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': '5235407', 'n_tokens_mistral': 435, 'n_tokens_neox': 427, 'n_words': 109}