<commit_before>var fs_module = require('fs');

module.exports = {
	name : 'static',
	router_catch_all : /\.(js|css|txt|html|ico)$/,
	routes : [{ 
		match : /^\/(([\w.\/]+)\.(js|css|txt|html|ico))$/,
		options : {
			keys : ['file', 'name', 'ext'],
			ignore_template : true
		},
		modes : ['text/javascript', 'text/css', 'text/plain'],
		GET : function (uri_bundle, view) {
			var request_date = uri_bundle.headers['if-modified-since'];
			var path = view.dir + uri_bundle.params.file;

			switch (uri_bundle.params.ext) {
				case 'js':
					view.setContentType('text/javascript');
					break;

				case 'css':
					view.setContentType('text/css');
					break;

				case 'txt':
				case 'html':
				default:
					view.setContentType('text/plain');
					break;
			}

			// can we improve this further? it would be nice to not need to stat a file each request
			fs_module.stat(path, function (err, stats) {				<commit_msg>move route modes into options<commit_after>var fs_module = require('fs');

module.exports = {
	name : 'static',
	router_catch_all : /\.(js|css|txt|html|ico)$/,
	routes : [{ 
		match : /^\/(([\w.\/]+)\.(js|css|txt|html|ico))$/,
		options : {
			keys : ['file', 'name', 'ext'],
			ignore_template : true,
			modes : ['text/javascript', 'text/css', 'text/plain'],
		},
		GET : function (uri_bundle, view) {
			var request_date = uri_bundle.headers['if-modified-since'];
			var path = view.dir + uri_bundle.params.file;

			switch (uri_bundle.params.ext) {
				case 'js':
					view.setContentType('text/javascript');
					break;

				case 'css':
					view.setContentType('text/css');
					break;

				case 'txt':
				case 'html':
				default:
					view.setContentType('text/plain');
					break;
			}

			// can we improve this further? it would be nice to not need to stat a file each request
			fs_module.stat(path, function (err, stats) {				
{'fraction_non_alphanumeric': 0.17669172932330826, 'fraction_numerical': 0.0, 'mean_word_length': 3.067685589519651, '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': '2952672', 'n_tokens_mistral': 771, 'n_tokens_neox': 628, 'n_words': 148}