<commit_before>'use strict';

const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const http = require('http');

const request = require('../common/request');
const common = require('../common/common');

let config;

if (process.env.NODE_ENV === "local") {
	config = require('../config/local.json');
} else {
	config = require('../config/prod.json');
}

app.use(bodyParser.json());

function makeInsuranceRequest(mlsID, mortID) {
	const body = {
		mlsID,
		mortID,
		services: {
			police: Math.random() > 0.5,
			water: Math.random() > 0.5,
			school: Math.random() > 0.5,
			sewage: Math.random() > 0.5
		}
	}
	const {
		domain,
		port
	} = config.hostnames.insinc;
	request.makeRequest(domain, port, '/insinc/municipal', 'POST', body);
}

function logAndRespond(request, response, endpoint, code, message) {
	common.logInfo("MUN", endpoint, request, code, message);
	return response.status(code).send(message);
}

app.post('/mun/appraisal', function(req, res) {
	if (!req.body.mlsID) {
		return logAndRespond(req, res, '/mun/appraisal', 400, 'Bad Request missing body parameter mlsID');
	}

	if (!req.body.mortID) {
		return logAndRespond(req, res, '/re/appraisal', 400, 'Bad Request missing body parameter mortID');
	}

	logAndRespond(req, res, '/mun/appraisal', 200, 'OK');

	makeInsuranceRequest(req.body.mlsID, req.body.mortID);
});

app.listen(config.hostnames.mun.port, function() {
	console.log(`MUN listening on port ${config.hostnames.mun.port}`);
});<commit_msg>health route for mun<commit_after>'use strict';

const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const http = require('http');

const request = require('../common/request');
const common = require('../common/common');

let config;

if (process.env.NODE_ENV === "local") {
	config = require('../config/local.json');
} else {
	config = require('../config/prod.json');
}

app.use(bodyParser.json());

function makeInsuranceRequest(mlsID, mortID) {
	const body = {
		mlsID,
		mortID,
		services: {
			police: Math.random() > 0.5,
			water: Math.random() > 0.5,
			school: Math.random() > 0.5,
			sewage: Math.random() > 0.5
		}
	}
	const {
		domain,
		port
	} = config.hostnames.insinc;
	request.makeRequest(domain, port, '/insinc/municipal', 'POST', body);
}

function logAndRespond(request, response, endpoint, code, message) {
	common.logInfo("MUN", endpoint, request, code, message);
	return response.status(code).send(message);
}

app.get('/', function(req, res) {
	res.send('MUN Running');
});

app.post('/mun/appraisal', function(req, res) {
	if (!req.body.mlsID) {
		return logAndRespond(req, res, '/mun/appraisal', 400, 'Bad Request missing body parameter mlsID');
	}

	if (!req.body.mortID) {
		return logAndRespond(req, res, '/re/appraisal', 400, 'Bad Request missing body parameter mortID');
	}

	logAndRespond(req, res, '/mun/appraisal', 200, 'OK');

	makeInsuranceRequest(req.body.mlsID, req.body.mortID);
});

app.listen(config.hostnames.mun.port, function() {
	console.log(`MUN listening on port ${config.hostnames.mun.port}`);
});
{'fraction_non_alphanumeric': 0.18353619474695707, 'fraction_numerical': 0.010890454836643177, 'mean_word_length': 4.576785714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2161930', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1075, 'n_words': 240}