Mercurial > psgxs
view modules/mod_http.js @ 38:5395a501c991
Use internal toISOString method of Data.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 16 Nov 2010 19:00:15 +0100 |
parents | 62cbb1c49bc5 |
children | bc717575e66a |
line wrap: on
line source
var config = require('../configuration'); var http = require('http'); var files = require('fs').readdirSync('modules/http'); var regex = /^mod_.*\.js/; var sites = {}; for (var i in files) { var file = files[i]; if (!regex.test(file)) continue; var module = require('./http/' + files[i]); for (var j in module) { if (typeof sites[j] != 'undefined') console.log('WARNING: module '+j+' already loaded.'); sites[j] = module[j]; } } http.createServer(function (req, res) { var sent = false; for (var i in sites) { var site = sites[i]; if (!site.url.test(req.url)) continue; sent = site.func(req, res); return; } if (!sent) { res.writeHead(404, {'Content-Type': 'text/plain'}); res.end('Error 404'); } }).listen(8484);