Created
March 23, 2019 03:42
-
-
Save areai51/4c60e179fb99580dce5868e57f53dc11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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