No Prerender.io
This commit is contained in:
1 parent
acf1eee521
commit
c2a457eea7
2 files changed
-16
No files matched your search
@@ -46,7 +46,6 @@
|
|||||||
"koa-helmet": "^1.0.0",
|
"koa-helmet": "^1.0.0",
|
||||||
"koa-logger": "^2.0.0",
|
"koa-logger": "^2.0.0",
|
||||||
"koa-mount": "^2.0.0",
|
"koa-mount": "^2.0.0",
|
||||||
"koa-prerender": "^1.0.3",
|
|
||||||
"koa-query": "0.0.2",
|
"koa-query": "0.0.2",
|
||||||
"koa-route": "^3.1.0",
|
"koa-route": "^3.1.0",
|
||||||
"koa-static": "^3.0.0",
|
"koa-static": "^3.0.0",
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import logger from 'koa-logger'
|
|||||||
import convert from 'koa-convert'
|
import convert from 'koa-convert'
|
||||||
import conditional from 'koa-conditional-get'
|
import conditional from 'koa-conditional-get'
|
||||||
import etag from 'koa-etag'
|
import etag from 'koa-etag'
|
||||||
import prerender from 'koa-prerender'
|
|
||||||
import helmet from 'koa-helmet'
|
import helmet from 'koa-helmet'
|
||||||
import mount from 'koa-mount'
|
import mount from 'koa-mount'
|
||||||
import cookie from 'koa-cookie'
|
import cookie from 'koa-cookie'
|
||||||
@@ -45,8 +44,6 @@ export default function (store) {
|
|||||||
app.use(cookie())
|
app.use(cookie())
|
||||||
app.use($(conditional()))
|
app.use($(conditional()))
|
||||||
app.use($(etag()))
|
app.use($(etag()))
|
||||||
app.use(prerenderRmFragment())
|
|
||||||
app.use($(prerender(config.prerender)))
|
|
||||||
app.use(serve(dirPublic))
|
app.use(serve(dirPublic))
|
||||||
app.use(serve(dirTemplates))
|
app.use(serve(dirTemplates))
|
||||||
app.use($(redirect(redirectionTable)))
|
app.use($(redirect(redirectionTable)))
|
||||||
@@ -66,15 +63,3 @@ function apis(store) {
|
|||||||
let checkAuth = authChecker(serviceKeys)
|
let checkAuth = authChecker(serviceKeys)
|
||||||
return mount('/api/v1', apiV1(checkAuth, store))
|
return mount('/api/v1', apiV1(checkAuth, store))
|
||||||
}
|
}
|
||||||
|
|
||||||
function prerenderRmFragment() {
|
|
||||||
return async(ctx, next) => {
|
|
||||||
await next()
|
|
||||||
|
|
||||||
try {
|
|
||||||
let xp = ctx.response.header['x-prerender'] === 'true'
|
|
||||||
if (xp) ctx.body = ctx.body.replace('<meta name="fragment" content="!">', '')
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user