<commit_before>var  config = require('./lib/server/config.js'),
	 bodyParser = require('body-parser'),
	 serverStatic = require('serve-static'),
	 path = require('path'),
	 connect = require('connect'),
     http = require('http'),
     siteLookup = require('./lib/server/SiteLookup.js'),
     uploader = require('./lib/server/Uploader.js')(config.getApiEngine()),
     webFront = require('./lib/server/WebFront.js')();

// deal with the www path
var  port = config.getServer().port || 8080,
	 wwwPath = config.getWWW();

var app = connect()
	.use(require('morgan')('dev'))
	.use(require('cookie-parser')())
	.use(serverStatic(path.join(__dirname, './www/admin/cont')))
	.use(serverStatic(wwwPath + '/cont'))
	//.use(require('serve-static')(wwwPath + '/cont'))
	//.use(require('express-session')({ secret: 'my secret here' }))
	.use(siteLookup)
	.use(uploader)
	.use(bodyParser.urlencoded({extended: true}))
	.use(webFront);

var  server = http.createServer(app);
server.listen(port);

exports.restart = function()  {
	server.close();
	server = http.createServer(app);
	server.listen(port);
}
<commit_msg>enable static file access for all websites<commit_after>var  fs = require('fs'),
	 config = require('./lib/server/config.js'),
	 bodyParser = require('body-parser'),
	 serverStatic = require('serve-static'),
	 path = require('path'),
	 connect = require('connect'),
     http = require('http'),
     siteLookup = require('./lib/server/SiteLookup.js'),
     uploader = require('./lib/server/Uploader.js')(config.getApiEngine()),
     webFront = require('./lib/server/WebFront.js')();

// deal with the www path
var  port = config.getServer().port || 8080,
	 wwwPath = config.getWWW();

var app = connect()
	.use(require('morgan')('dev'))
	.use(require('cookie-parser')())
	.use(serverStatic(wwwPath + '/cont'));
	//.use(require('express-session')({ secret: 'my secret here' }))

// supply static file directories for all sites running on coServ
var  staticList = listStaticPath();
for (var i in staticList)  {
	app.use(serverStatic(staticList[i]));
}

app
.use(siteLookup)
.use(require('connect-multiparty')())
.use(uploader)
.use(bodyParser.urlencoded({extended: true}))
.use(webFront);

var  server = http.createServer(app);
server.listen(port);

exports.restart = function()  {
	server.close();
	server = http.createServer(app);
	server.listen(port);
}


function  listStaticPath()  {
	var  siteFile = path.join( wwwPath, 'sites.json' ),
		 pathList = [];

	try  {
		var  sites = JSON.parse( fs.readFileSync(siteFile) );
		for (var domain in sites)  {
			var  siteInfo = sites[domain],
				 sitePath = siteInfo.sitePath;

			if (sitePath)  {
				if (sitePath.charAt(0) === '.')
					sitePath = path.join( wwwPath, sitePath );

				pathList.push( path.join(sitePath, './cont') );
			}
		}
	}
	catch (e)  {
		console.error( e );
	}

	return  pathList;
}
{'fraction_non_alphanumeric': 0.18964310706787962, 'fraction_numerical': 0.0031490552834149755, 'mean_word_length': 4.226691042047532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, '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': '4058019', 'n_tokens_mistral': 993, 'n_tokens_neox': 943, 'n_words': 187}