import { createOvermindSSR } from 'overmind'
import { config } from '../client/overmind'
export default async (req, res) => {
const overmind = createOvermindSSR(config)
overmind.state.currentPage = 'posts'
overmind.state.posts = await db.getPosts()
const html = renderToString(
// Whatever your view layer does to produce the HTML
<div id="app">${html}</div>
window.__OVERMIND_MUTATIONS = ${JSON.stringify(overmind.hydrate())}
<script src="/scripts/app.js"></script>