<commit_before>var coffee = require("./coffee.js");
var cantina = require("./cantina.js");
var office = require("./office.js");
var http = require("http");

var server = http.createServer(function(req, res){
	var urlInfo = req.url.split("/");
	if (urlInfo.length !== 3){
		if (urlInfo.length == 2 && (urlInfo[1] == "info" || urlInfo[1] == "help")){
			res.end(getHelpText());
		}else
			res.end("Something wrong happend!");
	}
	else if (urlInfo[1] === "coffee"){
		coffee.get(true, urlInfo[2], function(tx1, tx2){
			res.end(tx1 + "\n" + tx2);
		});
	}else if (urlInfo[1] === "office"){
		office.get(urlInfo[2], function(status, message){
			res.end(status + "\n" + message);
		});
	}
	else {
		res.end("Wrong input");
	}
});

function getHelpText(){
	var info = "write in url: localhost/info1/info2";
	var info1 = "coffee/linjeforening\noffice/linjeforening";
	return info + "\n" + info1;
}

server.listen(80);

// coffee.get(true, function(text1, text2){
// 	console.log(text1);
// 	console.log(text2);<commit_msg>hackerspace is now supported<commit_after>var coffee = require("./coffee.js");
var cantina = require("./cantina.js");
var office = require("./office.js");
var http = require("http");
var hackerspace = require("./hackerspace.js");

var server = http.createServer(function(req, res){
	var urlInfo = req.url.split("/");
	if (urlInfo.length !== 3){
		if (urlInfo.length == 2){
			if (urlInfo[1] == "info" || urlInfo[1] == "help" || urlInfo[1] == ""){
				res.end(getHelpText());
			}
			else if (urlInfo[1] == "hackerspace"){
				hackerspace.get(function(isOpen){
					res.end(isOpen);
				});
			} 
		}
		else
			res.end("Something wrong happend!");
	}
	else if (urlInfo[1] === "coffee"){
		coffee.get(true, urlInfo[2], function(tx1, tx2){
			res.end(tx1 + "\n" + tx2);
		});
	}else if (urlInfo[1] === "office"){
		office.get(urlInfo[2], function(status, message){
			res.end(status + "\n" + message);
		});
	}
	else {
		res.end("Wrong input");
	}
});

function getHelpText(){
	var info = "localhost/info/linjeforening";
	var info1 = "coffee\noffice";
	var info2 = "localhost/hackerspace";
	return info + "\n" + info1 + "\n" + info2;
}

server.listen(80);

// coffee.get(true, function(text1, text2){
// 	console.log(text1);
// 	console.log(text2);
{'fraction_non_alphanumeric': 0.21760283060592658, 'fraction_numerical': 0.020344980097302078, 'mean_word_length': 4.015521064301552, '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': '4773395', 'n_tokens_mistral': 948, 'n_tokens_neox': 869, 'n_words': 173}