1234567891011121314151617181920212223242526272829303132333435363738 |
- var https = require('https');
- var express = require('express');
- var fs = require('fs');
- var options = {
- key: fs.readFileSync('../shared/server.key'),
- cert: fs.readFileSync('../shared/server.crt')
- };
- var app = express();
- app.configure(function(){
- app.use(express.methodOverride());
- app.use(express.bodyParser());
- app.use(app.router);
- app.set('view engine', 'jade');
- app.set('views', __dirname + '/public');
- app.set('view options', {layout: false});
- app.set('basepath',__dirname + '/public');
- });
- app.configure('development', function(){
- app.use(express.static(__dirname + '/public'));
- app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
- });
- app.configure('production', function(){
- var oneYear = 31557600000;
- app.use(express.static(__dirname + '/public', { maxAge: oneYear }));
- app.use(express.errorHandler());
- });
- console.log("Web server has started.\nPlease log on http://127.0.0.1:3001/index.html");
- var httpsServer = https.createServer(options, app);
- httpsServer.listen(3001);
|