Skip to content

Instantly share code, notes, and snippets.

@areai51
Created March 23, 2019 03:42
Show Gist options
  • Select an option

  • Save areai51/4c60e179fb99580dce5868e57f53dc11 to your computer and use it in GitHub Desktop.

Select an option

Save areai51/4c60e179fb99580dce5868e57f53dc11 to your computer and use it in GitHub Desktop.
const express = require('express');
const helment = require('helmet');
const Tailor = require('node-tailor');
const { fetchTemplate, filterRequestHeaders } = require('./middleware/tailor');
const tailor = new Tailor({
fetchTemplate,
filterRequestHeaders,
});
const app = express();
app.use(helment());
app.get('/', function(req, res, next) {
req.url = '/index';
next();
});
app.use(express.static('dist'));
app.use(tailor.requestHandler);
const port = 3000;
app.listen(port, () => console.log(`Server listening on port ${port}`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment