changeset 17:32f7526da5fe

Remove the hardcoded index.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 10 Jul 2011 15:39:48 +0200
parents 27eaec05cfd0
children 92d6e1b40df5
files avatar.js
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/avatar.js
+++ b/avatar.js
@@ -230,6 +230,11 @@ http.createServer(function (req, res) {
 		},
 		README: {},
 		COPYING: {},
+		'index.xhtml': {
+			re: /\/(index.xhtml)?$/,
+			mime: 'application/xhtml+xml',
+			error: '<h1 xmlns="http://www.w3.org/1999/xhtml">Index file not available.</h1>'
+		}
 	};
 
 	req.setEncoding('utf-8');
@@ -251,17 +256,6 @@ http.createServer(function (req, res) {
 
 	var jid = unescape(req.url.replace(new RegExp(config.webRoot), ''));
 
-	if (jid === '') {
-		res.writeHead(200, {'Content-Type': 'application/xhtml+xml'});
-		fs.readFile('index.xhtml', function(err, data) {
-			if (err)
-				throw err;
-
-			res.end(data);
-		});
-		return;
-	}
-
 	if (jid === 'redirect') {
 		if (req.method !== 'POST') {
 			res.writeHead(404, {'Content-Type': 'text/plain'});