<commit_before>'use strict';

var Mussel = require('./index.js');
var express = require("express");

var bunyan = require('bunyan');
var log = bunyan.createLogger({name: "musselrunner"});

var app = express();

app.get("/auths/:userid", function(req, res) {
	res.header("Access-Control-Allow-Origin", "*");
	res.header("Access-Control-Allow-Headers", "X-Requested-With");
	var auths = mussel.getAuths(req.params.userid, function(err, response) {
	if (err) {
		log.warn(err, "Error getting authorizations");
		res.send(err);
	} else {
		res.send(response);
	}
	});
});

app.get("/deauthorize/:shim", function(req, res) {
	var username = req.query.username;
	res.header("Access-Control-Allow-Origin", "*");
	res.header("Access-Control-Allow-Headers", "X-Requested-With");
	mussel.deauthorize(req.params.shim, username, function(err, response) {
		if (err) {
			log.warn(err, "Error deauthorizing");
			res.send(err);
		} else{
			res.send(response);
		}
	});

});

var SHIMMER_HOST=process.env.SHIMMER_HOST;

var TIDEPOOL_HOST=process.env.TIDEPOOL_HOST;
var TIDEPOOL_UPLOAD_HOST=process.env.TIDEPOOL_UPLOAD_HOST;

var UPLOADER_LOGIN=process.env.UPLOADER_LOGIN;
var UPLOADER_PASSWORD=process.env.UPLOADER_PASSWORD;
var UPLOADER_USERID=process.env.UPLOADER_USERID;


var tidepoolConfig = {
			host: TIDEPOOL_HOST,
		  	uploadApi: TIDEPOOL_UPLOAD_HOST,
		  	uploaderDetails: {uploaderLogin:UPLOADER_LOGIN, uploaderPassword:<PASSWORD>, uploaderUserId: UPLOADER_USERID  }
		  	};
var shimmerConfig = {'host':SHIMMER_HOST};

log.info('TidePool Config:');
log.info(tidepoolConfig);
log.info('Shimmer Config:');<commit_msg>send http error response code when there is an error rather than just the message<commit_after>'use strict';

var Mussel = require('./index.js');
var express = require("express");

var bunyan = require('bunyan');
var log = bunyan.createLogger({name: "musselrunner"});

var app = express();

app.get("/auths/:userid", function(req, res) {
	res.header("Access-Control-Allow-Origin", "*");
	res.header("Access-Control-Allow-Headers", "X-Requested-With");
	var auths = mussel.getAuths(req.params.userid, function(err, response) {
	if (err) {
		log.warn(err, "Error getting authorizations");
		res.status(500).send({ error: 'unable to retrieve auths', errorMsg:err });
	} else {
		res.send(response);
	}
	});
});

app.get("/deauthorize/:shim", function(req, res) {
	var username = req.query.username;
	res.header("Access-Control-Allow-Origin", "*");
	res.header("Access-Control-Allow-Headers", "X-Requested-With");
	mussel.deauthorize(req.params.shim, username, function(err, response) {
		if (err) {
			log.warn(err, "Error deauthorizing");
			res.status(500).send({ error: 'unable to deauthorize', errorMsg:err });
		} else{
			res.send(response);
		}
	});

});

var SHIMMER_HOST=process.env.SHIMMER_HOST;

var TIDEPOOL_HOST=process.env.TIDEPOOL_HOST;
var TIDEPOOL_UPLOAD_HOST=process.env.TIDEPOOL_UPLOAD_HOST;

var UPLOADER_LOGIN=process.env.UPLOADER_LOGIN;
var UPLOADER_PASSWORD=<PASSWORD>.UPLOADER_PASSWORD;
var UPLOADER_USERID=process.env.UPLOADER_USERID;


var tidepoolConfig = {
			host: TIDEPOOL_HOST,
		  	uploadApi: TIDEPOOL_UPLOAD_HOST,
		  	uploaderDetails: {uploaderLogin:UPLOADER_LOGIN, uploaderPassword:<PASSWORD>, uploaderUserId: UPLOADER_USERID  }
		  	};
var shimmerConfig = {'host':SHIMMER_HOST};

log.info('TidePool Config:');
log.info(tidepoolConfig);
log.info('Shimmer Config:');
{'fraction_non_alphanumeric': 0.16099706744868036, 'fraction_numerical': 0.0017595307917888563, 'mean_word_length': 5.675146771037182, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '2797149', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1300, 'n_words': 204}