1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-universal-configuration-runtime/pages/_document.js
2017-12-02 18:08:53 +01:00

28 lines
596 B
JavaScript

import Document_, { Head, Main, NextScript } from 'next/document'
import htmlescape from 'htmlescape'
const { API_URL } = process.env
const env = { API_URL }
export default class Document extends Document_ {
static async getInitialProps (ctx) {
const props = await Document_.getInitialProps(ctx)
return props
}
render () {
return (
<html>
<Head />
<body>
<Main />
<script
dangerouslySetInnerHTML={{ __html: '__ENV__ = ' + htmlescape(env) }}
/>
<NextScript />
</body>
</html>
)
}
}