<commit_before>var express = require("express");
var morgan = require("morgan");
var http = require("http");
var request = require("request");
var _ = require("underscore");

var config = require("./lib/config")({
	PORT : 3000,
	YO_API_KEY : "INSERT KEY HERE",
	YO_API_SEND_URL : "https://api.justyo.co/yo/",
	RESPONSE_URL_FORMAT : "${SCHEME}://${HOST}/public/message.html?${TOKEN}",
	MESSAGES : "Message1|Message2"
});

var messages = config.get("MESSAGES").split("|");
var url_template = _.template(config.get("RESPONSE_URL_FORMAT"), { interpolate : /\$\{(.+?)\}/ });

var app = express();
app.use(morgan('dev'));

app.use("/public", express.static(__dirname + "/public"));

app.get("/yo", function(req, res) {
	var model = {
		HOST : req.get("HOST"),
		SCHEME : (req.connection.encrypted || req.headers['x-forwarded-proto'] === "https") ? "https" : "http",
		TOKEN : encodeURIComponent(messages[Math.floor(Math.random()*messages.length)]),
		USERNAME : req.query.username
	 };
	request.post(config.get("YO_API_SEND_URL"), { form : { api_token : config.get("YO_API_KEY"), username : req.query.username, link : url_template(model) } }, function(err, response) {
		if(err) {
			return res.send("ERROR: " + err);
		}
		res.send(url_template(model));
	}); 
});

app.listen(config.get("PORT"), function(err) {<commit_msg>Working on logging for response<commit_after>var express = require("express");
var morgan = require("morgan");
var http = require("http");
var request = require("request");
var _ = require("underscore");

var config = require("./lib/config")({
	PORT : 3000,
	YO_API_KEY : "INSERT KEY HERE",
	YO_API_SEND_URL : "https://api.justyo.co/yo/",
	RESPONSE_URL_FORMAT : "${SCHEME}://${HOST}/public/message.html?${TOKEN}",
	MESSAGES : "Message1|Message2"
});

var messages = config.get("MESSAGES").split("|");
var url_template = _.template(config.get("RESPONSE_URL_FORMAT"), { interpolate : /\$\{(.+?)\}/ });

var app = express();
app.use(morgan('dev'));

app.use("/public", express.static(__dirname + "/public"));

app.get("/yo", function(req, res) {
	var model = {
		HOST : req.get("HOST"),
		SCHEME : (req.connection.encrypted || req.headers['x-forwarded-proto'] === "https") ? "https" : "http",
		TOKEN : encodeURIComponent(messages[Math.floor(Math.random()*messages.length)]),
		USERNAME : req.query.username
	 };
	request.post(config.get("YO_API_SEND_URL"), { form : { api_token : config.get("YO_API_KEY"), username : req.query.username, link : url_template(model) } }, function(err, response) {
		console.log(response);
		if(err) {
			return res.send("ERROR: " + err);
		}
		res.send(url_template(model));
	}); 
});

app.listen(config.get("PORT"), function(err) {
{'fraction_non_alphanumeric': 0.21425905188503172, 'fraction_numerical': 0.004479283314669653, 'mean_word_length': 5.247086247086247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3116878', 'n_tokens_mistral': 979, 'n_tokens_neox': 944, 'n_words': 159}