<commit_before>const express = require("express");
const connect = require("../utils/database.js");
const _ = require("lodash");

let app = express.Router();

app.get("/", function(req, res){
	res.send("<p>Welcome to the API Endpoint. Please refer to the documentation for its usage.</p>");
});

app.get("*", function(req, res, next){
	res.header("Access-Control-Allow-Origin", "*");
	next();
});

app.get("/:collection*", function(req, res, next){
	if(req.params.collection.substr(0, 1) == "_"){
		res.status(403).send({error: "Collection name may not start with _"});
	}else{
		next();
	}
});
<commit_msg>Extra headers for API<commit_after>const express = require("express");
const connect = require("../utils/database.js");
const _ = require("lodash");

let app = express.Router();

app.use(function(req, res, next){
	res.header("Access-Control-Allow-Origin", "*");
	res.header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS');
	res.header('Access-Control-Allow-Headers', 'Origin, Content-Type, X-Auth-Token');
	next();
});

app.get("/", function(req, res){
	res.send("<p>Welcome to the API Endpoint. Please refer to the documentation for its usage.</p>");
});

app.get("/:collection*", function(req, res, next){
	if(req.params.collection.substr(0, 1) == "_"){
		res.status(403).send({error: "Collection name may not start with _"});
	}else{
		next();
	}
});

{'fraction_non_alphanumeric': 0.21485219899062724, 'fraction_numerical': 0.007209805335255948, 'mean_word_length': 5.168888888888889, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6148361', 'n_tokens_mistral': 476, 'n_tokens_neox': 457, 'n_words': 109}