<commit_before>"use strict";

const express = require("express");
const app = express();

app.enable("trust proxy");

const config = require("./config.js");
const root = config.root;

const controller = require("./controller/app.js");

const bodyParser = require("body-parser");
const cookieParser = require("cookie-parser");

app.use(bodyParser.json());
app.use(cookieParser());

app.use((req, res, next) => {
	controller.verify(req, (verifiedUser) => {
		req.verifiedUser = verifiedUser;

		next();
	});
});

app.get("/", (req, res) => {
	res.sendFile("./view/index.html", {root: root});
});

app.post("/signup", (req, res) => {
	res.sendStatus(501);
});

app.post("/signin", (req, res) => {
	res.sendStatus(501);
});

app.post("/signin/forgot-password", (req, res) => {
	res.sendStatus(501);
});

app.post("/settings/change-password", (req, res) => {
	if (req.verifedUser) {
		controller.changePassword(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.post("/logout", (req, res) => {
	if (req.verifiedUser) {
		controller.logout(req, res);
	} else {
		res.sendStatus(400);
	}
});

app.delete("/settings/delete-account", (req, res) => {
	if (req.verifedUser) {
		controller.deletAccount(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.put("/add", (req, res) => {
	if (req.verifedUser) {
		controller.addItem(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.put("/mutate", (req, res) => {
	if (req.verifedUser) {
		controller.mutateItem(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.delete("/delete", (req, res) => {
	if (req.verifiedUser) {
		controller.deleteItem(req, res);
	} else {
		res.sendStatus(403);
	}
});

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

app.use((req, res) => {
	res.sendStatus(400);
});

app.listen(8080, () => console.log("todo running on port 8080"));
<commit_msg>Fix static files<commit_after>"use strict";

const express = require("express");
const app = express();

app.enable("trust proxy");

const config = require("./config.js");
const root = config.root;

const controller = require("./controller/app.js");

const bodyParser = require("body-parser");
const cookieParser = require("cookie-parser");

app.use(bodyParser.json());
app.use(cookieParser());

app.use((req, res, next) => {
	controller.verify(req, (verifiedUser) => {
		req.verifiedUser = verifiedUser;

		next();
	});
});

app.get("/", (req, res) => {
	res.sendFile("./view/index.html", {root: root});
});

app.post("/signup", (req, res) => {
	res.sendStatus(501);
});

app.post("/signin", (req, res) => {
	res.sendStatus(501);
});

app.post("/signin/forgot-password", (req, res) => {
	res.sendStatus(501);
});

app.post("/settings/change-password", (req, res) => {
	if (req.verifedUser) {
		controller.changePassword(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.post("/logout", (req, res) => {
	if (req.verifiedUser) {
		controller.logout(req, res);
	} else {
		res.sendStatus(400);
	}
});

app.delete("/settings/delete-account", (req, res) => {
	if (req.verifedUser) {
		controller.deletAccount(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.put("/add", (req, res) => {
	if (req.verifedUser) {
		controller.addItem(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.put("/mutate", (req, res) => {
	if (req.verifedUser) {
		controller.mutateItem(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.delete("/delete", (req, res) => {
	if (req.verifiedUser) {
		controller.deleteItem(req, res);
	} else {
		res.sendStatus(403);
	}
});

app.use(express.static(root + "/view"));

app.use((req, res) => {
	res.sendStatus(400);
});

app.listen(8080, () => console.log("todo running on port 8080"));

{'fraction_non_alphanumeric': 0.2291838417147568, 'fraction_numerical': 0.020884858477603737, 'mean_word_length': 4.321637426900585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '5459740', 'n_tokens_mistral': 1472, 'n_tokens_neox': 1387, 'n_words': 237}