<commit_before>var projectAwesome = require('project-awesome');
var requestChecker = require('../../middleware/request-checker.js');
var requireQuery = requestChecker.requireQuery;

module.exports = function(app) {

	app.get('/v1/check', function(req,res) {
		try {
			res.json({valid: projectAwesome.check(req.query.type, req.query.value)});
		}catch(e) {
			res.status(400).end();
		}
	});

	app.get('/v1/list', function(req, res) {
		try {
			res.json({list: projectAwesome.list(req.query.type)});
		} catch(e) {
			res.status(400).end();
		}
	});
	

}

// 	app.get('/v1/is_seed_valid', requireQuery('seed'), function(req, res) {
// 		var is_seed_valid = projectAwesome.isSeedValid(req.query.seed);
// 		res.json({ is_seed_valid: is_seed_valid }).end();
// 	});

// 	app.get('/v1/is_valid_question_type', requireQuery('question_type'), function(req, res) {
// 		var is_valid_question_type = projectAwesome.isValidQuestionType(req.query.question_type);
// 		res.json({ is_valid_question_type: is_valid_question_type }).end();
// 	});

// 	app.get('/v1/generate_moodle_xml', 
// 		requireQuery('question_type'), 
// 		requireQuery('count'), 
// 		requireQuery('question_name'), 
// 		requireQuery('seed'), 
// 		function(req, res) {
// 			if (!projectAwesome.isSeedValid(req.query.seed)) {<commit_msg>Try adding some error checking to check part of api<commit_after>var projectAwesome = require('project-awesome');
var requestChecker = require('../../middleware/request-checker.js');
var requireQuery = requestChecker.requireQuery;

module.exports = function(app) {

	app.get('/v1/check', function(req,res) {
		try {
			res.json({valid: projectAwesome.check(req.query.type, req.query.value)});
		}catch(e) {

			res.status(400).json({
					valid: false,
					error: e
			});
			// res.status(400).end();
		}
	});

	app.get('/v1/list', function(req, res) {
		try {
			res.json({list: projectAwesome.list(req.query.type)});
		} catch(e) {
			res.status(400).end();
		}
	});
	

}

// 	app.get('/v1/is_seed_valid', requireQuery('seed'), function(req, res) {
// 		var is_seed_valid = projectAwesome.isSeedValid(req.query.seed);
// 		res.json({ is_seed_valid: is_seed_valid }).end();
// 	});

// 	app.get('/v1/is_valid_question_type', requireQuery('question_type'), function(req, res) {
// 		var is_valid_question_type = projectAwesome.isValidQuestionType(req.query.question_type);
// 		res.json({ is_valid_question_type: is_valid_question_type }).end();
// 	});

// 	app.get('/v1/generate_moodle_xml', 
// 		requireQuery('question_type'), 
// 		requireQuery('count'), 
// 		requireQuery('question_name'), 
// 		requireQuery('seed'), 
// 		function(req, res) {
// 			if (!projectAwesome.isSeedValid(req.query.seed)) {
{'fraction_non_alphanumeric': 0.19469026548672566, 'fraction_numerical': 0.009218289085545723, 'mean_word_length': 4.061567164179104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2705350', 'n_tokens_mistral': 1084, 'n_tokens_neox': 998, 'n_words': 130}