<commit_before>var bodyParser = require("body-parser");
var express = require("express");
var path = require("path");
var db = require("./db.js");
var app = express();

/* For Performance */
require("http").globalAgent.maxSockets = Infinity;

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

app.get("/", function (req, res) {
	res.sendFile(path.join(__dirname, "public/tab.html"));
});

app.post("/note", function (req, res, next) {
	if (!req.body.text.length) next("Zero length");
	db.save(req.body.text, function (err, note) {
		if (err) next(err);
		else res.json(note);
	});
});

app.post("/note/:id", function (req, res, next) {
	if (!req.body.text.length) next("Zero length");
	db.update(req.params.id, req.body.text, function (err, note) {
		if (err) next(err);
		else res.json(note);
	});
});

app.get("/note/:id", function (req, res, next) {
	db.get(req.params.id, function (err, note) {
		if (err) next(err);
		else res.json(note);
	});
});

app.use(function (err, req, res, next) {
	console.log(err);
	res.json({
		"error": err || "Something Broke"
	});
});

app.use(express.static("public"));

/* To prevent unknown errors */
process.on("uncaughtException", function (err) {
	console.log(err);
});

var port = process.env.NODE_PORT || 3000;
app.listen(port);
console.log("Listening on " + port);<commit_msg>public folder<commit_after>var bodyParser = require("body-parser");
var express = require("express");
var path = require("path");
var db = require("./db.js");
var app = express();

/* For Performance */
require("http").globalAgent.maxSockets = Infinity;

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

app.get("/", function (req, res) {
	res.sendFile(path.join(__dirname, "public/tab.html"));
});

app.post("/note", function (req, res, next) {
	if (!req.body.text.length) next("Zero length");
	db.save(req.body.text, function (err, note) {
		if (err) next(err);
		else res.json(note);
	});
});

app.post("/note/:id", function (req, res, next) {
	if (!req.body.text.length) next("Zero length");
	db.update(req.params.id, req.body.text, function (err, note) {
		if (err) next(err);
		else res.json(note);
	});
});

app.get("/note/:id", function (req, res, next) {
	db.get(req.params.id, function (err, note) {
		if (err) next(err);
		else res.json(note);
	});
});

app.use(function (err, req, res, next) {
	console.log(err);
	res.json({
		"error": err || "Something Broke"
	});
});

app.use(express.static(path.join(__dirname, "public")));

/* To prevent unknown errors */
process.on("uncaughtException", function (err) {
	console.log(err);
});

var port = process.env.NODE_PORT || 3000;
app.listen(port);
console.log("Listening on " + port);
{'fraction_non_alphanumeric': 0.218475073313783, 'fraction_numerical': 0.002932551319648094, 'mean_word_length': 4.685416666666667, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '1107342', 'n_tokens_mistral': 999, 'n_tokens_neox': 983, 'n_words': 217}