var express = require("express"); var fs = require("fs"); var https = require("https"); var path = require("path"); var proxy = require("simple-http-proxy"); var _ = require("underscore"); function clientPath(relativePath) { return path.resolve('../client/'+relativePath); } var httpsOptions = { key: fs.readFileSync(path.resolve('../qed-server.key')), cert: fs.readFileSync(path.resolve('../qed-server.pem')) }; var app = express(); app.use(express.logger()); app.use(express.compress()); app.use(express.favicon()); app.get('/', function(request, response){ response.sendfile(clientPath('index.html')); }); app.get('/*.html', function(request, response) { response.sendfile(clientPath(request.path)); }); _.each(['/dojo', '/dijit', '/dojox', '/qed', '/qed-client'], function(dir){ app.use(dir, express.static(clientPath(dir))); }); app.use('/data/couch', proxy('http://localhost:5984/qed')); var server = https.createServer(httpsOptions, app).listen(8443); console.log("Listening on https://localhost:8443/");