const GZIP = true;

var compression = require('compression')
var express = require('express')
var serveStatic = require('serve-static');
var path = require('path');

var app = express()

app.set('views', __dirname + '/showcase');
app.engine('.html', require('ejs').__express);
app.set('view engine', 'ejs');

if (GZIP) {
    function shouldCompress(req, res) {
        if (req.headers['x-no-compression']) {
            // don't compress responses with this request header
            return false
        }

        // fallback to standard filter function
        return compression.filter(req, res)
    }
    app.use(compression({ filter: shouldCompress }))
}

app.use(serveStatic(path.resolve(__dirname, '.')));
app.get('/', (req, res) => {
    res.render('showcase.html');
});
console.log('Started on port 3000...')
app.listen(3000);