Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var express = require('express'),
open = require('open'),
compression = require('compression'),
serveIndex = require('serve-index'),
serveStatic = require('serve-static'),
app = express(),
port = process.env.PORT || 8888,
sapui5 = '/sapui5',
url = 'http://localhost:' + port + sapui5, // + "/latest";
year = 60 * 60 * 24 * 365 * 1000;
// Use compress middleware to gzip content
app.use(compression());
//set default mime type to xml for ".library" files
express.static.mime.default_type = "text/xml";
// Serve up content directory showing hidden (leading dot) files
app.use(sapui5, serveStatic(__dirname, {
maxAge: year,
dotfiles: 'allow'
}));
// enable directory listening
app.use(sapui5, serveIndex(__dirname));
app.listen(port);
open(url); //open in default browser
console.log("Static file server running at\n => " + url + " \nCTRL + C to shutdown");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment