diff --git a/app/index.js b/app/index.js index bf082004..d3767383 100644 --- a/app/index.js +++ b/app/index.js @@ -1,8 +1,10 @@ var express = require('express'); var app = express(); +var compression = require('compression'); +var serveStatic = require('serve-static'); // Configure ejs engine -app.set('views', __dirname + '/../public'); +app.set('views', __dirname + '/../views'); app.engine('html', require('ejs').renderFile); // Force HTTPS on stackedit.io @@ -15,28 +17,42 @@ app.all('*', function(req, res, next) { }); // Use gzip compression -app.use(express.compress()); +app.use(compression()); // Serve static resources -app.use(express.static(__dirname + '/../public')); - -// Serve editor.html in /viewer -app.get('/editor', function (req, res) { - res.render('editor.html'); -}); - -// Serve viewer.html in /viewer -app.get('/viewer', function (req, res) { - res.render('viewer.html'); -}); +app.use(serveStatic(__dirname + '/../public')); app.post('/pdfExport', require('./pdf').export); app.post('/sshPublish', require('./ssh').publish); app.post('/picasaImportImg', require('./picasa').importImg); app.get('/downloadImport', require('./download').importPublic); -// Error 404 app.use(function(req, res, next) { + res.renderDebug = function(page) { + return res.render(page, { + cache: !req.query.hasOwnProperty('debug') + }); + }; + next(); +}); + +// Serve landing.html in / +app.get('/', function(req, res) { + res.renderDebug('landing.html'); +}); + +// Serve editor.html in /viewer +app.get('/editor', function(req, res) { + res.renderDebug('editor.html'); +}); + +// Serve viewer.html in /viewer +app.get('/viewer', function(req, res) { + res.renderDebug('viewer.html'); +}); + +// Error 404 +app.use(function(req, res) { res.status(404); res.render('error_404.html'); }); diff --git a/public/html/gdrive-action.html b/public/html/gdrive-action.html index f6fce3ee..50f6d711 100644 --- a/public/html/gdrive-action.html +++ b/public/html/gdrive-action.html @@ -3,7 +3,7 @@
+ + + + + +