<commit_before>'use strict'
//Server for demo application

const session = require('express-session')
const express = require('express')
const url = require('url')
const qs = require('qs')
const http = require('http')
const WebSocket = require('ws')
const compression = require('compression')

const app = express()

const sessionHandler = session({
	resave: true,
	saveUninitialized: true,
	secret: 'really secure'
})

app.use(compression())
app.use(sessionHandler)
app.use(express.static('dist'))

const server = http.createServer(app)

const wss = new WebSocket.Server({
	server: server,
	path: '/websocket'
})

server.listen(3000, () => {
	console.log('Listening on %d', server.address().port)
});

//Return the starting HTML to the client
//Just inlined it here as this is just an example server.
app.get('/', (req, res, next) => {
	const response = `
	<!DOCTYPE html>
	<html lang="en">
		<head>
			<meta charset="utf-8"/>
			<meta http-equiv="X-UA-Compatible" content="IE=edge">
			<meta name="viewport" content="width=device-width, initial-scale=1">
			<title>Tiny Browser Framework: Todo Example</title>
			<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
		</head>
		<body>
			<div class="container">
				<div class="page-header">
					<h1>Todo Example</h1>
				</div>
				<div id="count">${renderTodoCount(req.session)}</div>
				<ul id="lists" class="list-group"><commit_msg>make example server's port configurable<commit_after>'use strict'
//Server for demo application

const session = require('express-session')
const express = require('express')
const url = require('url')
const qs = require('qs')
const http = require('http')
const WebSocket = require('ws')
const compression = require('compression')

const app = express()

const sessionHandler = session({
	resave: true,
	saveUninitialized: true,
	secret: 'really secure'
})

app.use(compression())
app.use(sessionHandler)
app.use(express.static('dist'))

const server = http.createServer(app)

const wss = new WebSocket.Server({
	server: server,
	path: '/websocket'
})

const port = process.env.PORT || 3000
server.listen(port, () => {
	console.log('Listening on %d', server.address().port)
});

//Return the starting HTML to the client
//Just inlined it here as this is just an example server.
app.get('/', (req, res, next) => {
	const response = `
	<!DOCTYPE html>
	<html lang="en">
		<head>
			<meta charset="utf-8"/>
			<meta http-equiv="X-UA-Compatible" content="IE=edge">
			<meta name="viewport" content="width=device-width, initial-scale=1">
			<title>Tiny Browser Framework: Todo Example</title>
			<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
		</head>
		<body>
			<div class="container">
				<div class="page-header">
					<h1>Todo Example</h1>
				</div>
				<div id="count">${renderTodoCount(req.session)}</div>
				<ul id="lists" class="list-group">
{'fraction_non_alphanumeric': 0.1712962962962963, 'fraction_numerical': 0.007275132275132275, 'mean_word_length': 4.87378640776699, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 47, 'https://': 2, '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': '2309718', 'n_tokens_mistral': 1069, 'n_tokens_neox': 980, 'n_words': 249}