Created
November 10, 2015 23:02
-
-
Save stewones/e28ac56b42e5b552c2e2 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
var express = require('express'); | |
var compression = require('compression'); | |
var prerender = require('prerender-node'); | |
var bodyParser = require('body-parser'); | |
var Schema = mongoose.Schema; | |
var app = express(); | |
// Here we require the prerender middleware that will handle requests from Search Engine crawlers | |
// We set the token only if we're using the Prerender.io service | |
app.use(require('prerender-node') | |
.set('prerenderServiceUrl', 'http://service.prerender.io')); | |
app.use(express.static(__dirname + '/dist')); | |
app.use(compression()); | |
app.use(bodyParser.urlencoded({ | |
extended: true | |
})); | |
app.use(bodyParser.json()); | |
// | |
// handle all gets | |
// | |
app.get('/*', function(req, res) { | |
res.sendFile(__dirname + '/dist/index.html'); | |
}); | |
// | |
// Listen the app | |
// | |
app.listen(process.env.PORT || 3001); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment