<commit_before>var express = require("express");
var cfg = require("./config");
var _ = require("lodash");
var FileReader = require("./files");

var files = new FileReader(cfg.baseDir);

var app = express();

app.use(express.static("public"));
app.use("/recordings", express.static(cfg.baseDir));

app.get("/cameras", function(req, res) {
	return res.json(cfg.cameras);
});

app.get("/cameras/:id", function(req, res) {
	var cam = _.find(cfg.cameras, {
		id: req.params.id
	});

	if (!cam) {
		return res.status(404).json({
			message: "The camera with id '" + req.params.id + "' could not be found."
		});
	}

	files.readDates(cam.id).done(function(dates) {
		res.json(dates);
	});
});

app.get("/cameras/:id/:date", function(req, res) {
	var cam = _.find(cfg.cameras, {
		id: req.params.id
	});

	if (!cam) {
		return res.status(404).json({
			message: "The camera with id '" + req.params.id + "' could not be found."
		});
	}

	files.readVideos(cam.id, req.params.date).then(function(videos) {
		res.json(videos);
	}, function(err) {
		res.status(404).json({
			message: "There are no recordings for camera id '" + req.params.id + "' on date '" + req.params.date + "'."
		});
	});
});

//SPA
app.get("*", function(req, res, next) {
	req.url = "/";
	next();
});
app.use(express.static("public"));

var server = app.listen(process.env.PORT || 3000, function() {
	var host = server.address().address;
	var port = server.address().port;

	console.log("Camera app listening at http://%s:%s", host, port);
});<commit_msg>Use current directory name in public path<commit_after>var express = require("express");
var cfg = require("./config");
var _ = require("lodash");
var path = require("path");
var FileReader = require("./files");

var files = new FileReader(cfg.baseDir);

var app = express();

app.use(express.static(path.join(__dirname, "public")));
app.use("/recordings", express.static(cfg.baseDir));

app.get("/cameras", function(req, res) {
	return res.json(cfg.cameras);
});

app.get("/cameras/:id", function(req, res) {
	var cam = _.find(cfg.cameras, {
		id: req.params.id
	});

	if (!cam) {
		return res.status(404).json({
			message: "The camera with id '" + req.params.id + "' could not be found."
		});
	}

	files.readDates(cam.id).done(function(dates) {
		res.json(dates);
	});
});

app.get("/cameras/:id/:date", function(req, res) {
	var cam = _.find(cfg.cameras, {
		id: req.params.id
	});

	if (!cam) {
		return res.status(404).json({
			message: "The camera with id '" + req.params.id + "' could not be found."
		});
	}

	files.readVideos(cam.id, req.params.date).then(function(videos) {
		res.json(videos);
	}, function(err) {
		res.status(404).json({
			message: "There are no recordings for camera id '" + req.params.id + "' on date '" + req.params.date + "'."
		});
	});
});

//SPA
app.get("*", function(req, res, next) {
	req.url = "/";
	next();
});
app.use(express.static(path.join(__dirname, "public")));

var server = app.listen(process.env.PORT || 4000, function() {
	var host = server.address().address;
	var port = server.address().port;

	console.log("Camera app listening at http://%s:%s", host, port);
});
{'fraction_non_alphanumeric': 0.2149234693877551, 'fraction_numerical': 0.008290816326530613, 'mean_word_length': 3.987281399046105, 'pattern_counts': {'":': 0, '<': 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': '2506512', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1124, 'n_words': 241}