Permalink
Browse files

tweak server

1 parent 38dea77 commit f5ca53ac72356b2ae963a90cb61da0dc85d8d2b2 @yyx990803 yyx990803 committed Dec 29, 2016
Showing with 8 additions and 4 deletions.
  1. +8 −4 server.js
View
@@ -1,6 +1,3 @@
-process.env.VUE_ENV = 'server'
-const isProd = process.env.NODE_ENV === 'production'
-
const fs = require('fs')
const path = require('path')
const express = require('express')
@@ -9,6 +6,11 @@ const compression = require('compression')
const serialize = require('serialize-javascript')
const resolve = file => path.resolve(__dirname, file)
+const isProd = process.env.NODE_ENV === 'production'
+const serverInfo =
+ `express/${require('express/package.json').version} ` +
+ `vue-server-renderer/${require('vue-server-renderer/package.json').version}`
+
const app = express()
let indexHTML // generated by html-webpack-plugin
@@ -65,7 +67,9 @@ app.get('*', (req, res) => {
return res.end('waiting for compilation... refresh in a moment.')
}
- res.setHeader("Content-Type", "text/html");
+ res.setHeader("Content-Type", "text/html")
+ res.setHeader("Server", serverInfo)
+
var s = Date.now()
const context = { url: req.url }
const renderStream = renderer.renderToStream(context)

0 comments on commit f5ca53a

Please sign in to comment.