<commit_before>const express = require('express');
const browserCapabilities = require('browser-capabilities');

const app = express();
const basedir = __dirname + '/build/dash/bundled/';

function getSourcesPath(request) {
  let clientCapabilities = browserCapabilities.browserCapabilities(
    request.headers['user-agent']);

  clientCapabilities = new Set(clientCapabilities);

  if (clientCapabilities.has('es2015')) {
    return basedir + 'es6-bundled/';
  } else {
    return basedir + 'es5-bundled/';
  }
}


app.use('/dash/', (req, res, next)=> {
  express.static(getSourcesPath(req))(req, res, next);
});

app.get(/.*service-worker\.js/, function(req, res) {
  res.sendFile(getSourcesPath(req) + 'service-worker.js');
});


app.use(function(req, res) {
  // static file requrests that end up here are missing so they should return 404
  if (req.originalUrl.startsWith('/dash/app/')) {
    res.status(404).send('Not found');
  } else {
    // handles requests that look like /pmp/interventions/details
    res.sendFile(getSourcesPath(req) + 'index.html');
  }
});

app.listen(8080);


app.listen(8080);<commit_msg>fix express file<commit_after>const express = require('express');
const browserCapabilities = require('browser-capabilities');

const app = express();
const basedir = __dirname + '/build/dash/bundled/';

function getSourcesPath(request) {
  let clientCapabilities = browserCapabilities.browserCapabilities(
    request.headers['user-agent']);

  clientCapabilities = new Set(clientCapabilities);

  if (clientCapabilities.has('es2015')) {
    return basedir + 'es6-bundled/';
  } else {
    return basedir + 'es5-bundled/';
  }
}


app.use('/dash/', (req, res, next)=> {
  express.static(getSourcesPath(req))(req, res, next);
});

app.get(/.*service-worker\.js/, function(req, res) {
  res.sendFile(getSourcesPath(req) + 'service-worker.js');
});


app.use(function(req, res) {
  // static file requrests that end up here are missing so they should return 404
  if (req.originalUrl.startsWith('/dash/app/')) {
    res.status(404).send('Not found');
  } else {
    // handles requests that look like /pmp/interventions/details
    res.sendFile(getSourcesPath(req) + 'index.html');
  }
});

app.listen(8080);


{'fraction_non_alphanumeric': 0.16315553563424473, 'fraction_numerical': 0.016136261766024205, 'mean_word_length': 4.404358353510895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1290499', 'n_tokens_mistral': 749, 'n_tokens_neox': 713, 'n_words': 148}