<commit_before>/**
 * Web Client Server
 */

import * as path from 'path';
import ms = require('ms');

// express modules
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as favicon from 'serve-favicon';
import * as compression from 'compression';

const client = `${__dirname}/../../client/`;

// Create server
const app = express();
app.disable('x-powered-by');

app.use('/docs', require('./docs'));

app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({
	type: ['application/json', 'text/plain']
}));
app.use(compression());

app.use((req, res, next) => {
	res.header('X-Frame-Options', 'DENY');
	next();
});

//#region static assets

app.use(favicon(`${client}/assets/favicon.ico`));
app.get('/apple-touch-icon.png', (req, res) => res.sendFile(`${client}/assets/apple-touch-icon.png`));
app.use('/assets', express.static(`${client}/assets`, {
	maxAge: ms('7 days')
}));
app.use('/assets/*.js', (req, res) => res.sendFile(`${client}/assets/404.js`));
app.use('/assets', (req, res) => {
	res.sendStatus(404);
});

// ServiceWroker
app.get(/^\/sw\.(.+?)\.js$/, (req, res) =>
	res.sendFile(`${client}/assets/sw.${req.params[0]}.js`));

// Manifest
app.get('/manifest.json', (req, res) =>
	res.sendFile(`${client}/assets/manifest.json`));

//#endregion

app.get(/\/api:url/, require('./url-preview'));

// Render base html for all requests
app.get('*', (req, res) => {
	res.sendFile(path.resolve(`${client}/app/base.html`), {
		maxAge: ms('7 days')
	});
});

module.exports = app;
<commit_msg>Fix bug<commit_after>/**
 * Web Client Server
 */

import * as path from 'path';
import ms = require('ms');

// express modules
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as favicon from 'serve-favicon';
import * as compression from 'compression';

const client = path.resolve(`${__dirname}/../../client/`);

// Create server
const app = express();
app.disable('x-powered-by');

app.use('/docs', require('./docs'));

app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({
	type: ['application/json', 'text/plain']
}));
app.use(compression());

app.use((req, res, next) => {
	res.header('X-Frame-Options', 'DENY');
	next();
});

//#region static assets

app.use(favicon(`${client}/assets/favicon.ico`));
app.get('/apple-touch-icon.png', (req, res) => res.sendFile(`${client}/assets/apple-touch-icon.png`));
app.use('/assets', express.static(`${client}/assets`, {
	maxAge: ms('7 days')
}));
app.use('/assets/*.js', (req, res) => res.sendFile(`${client}/assets/404.js`));
app.use('/assets', (req, res) => {
	res.sendStatus(404);
});

// ServiceWroker
app.get(/^\/sw\.(.+?)\.js$/, (req, res) =>
	res.sendFile(`${client}/assets/sw.${req.params[0]}.js`));

// Manifest
app.get('/manifest.json', (req, res) =>
	res.sendFile(`${client}/assets/manifest.json`));

//#endregion

app.get(/\/api:url/, require('./url-preview'));

// Render base html for all requests
app.get('*', (req, res) => {
	res.sendFile(path.resolve(`${client}/app/base.html`), {
		maxAge: ms('7 days')
	});
});

module.exports = app;

{'fraction_non_alphanumeric': 0.25432969852469534, 'fraction_numerical': 0.005772931366260423, 'mean_word_length': 4.481546572934974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '1843077', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1118, 'n_words': 217}