import { join } from 'path'; import express from 'express'; import React from 'react'; import { renderToString } from 'react-dom/server'; import { getServerState } from 'react-instantsearch-hooks-server'; import App from './App'; const app = express(); app.use('/assets', express.static(join(__dirname, 'assets'))); app.get('/', async (req, res) => { const location = new URL( `${req.protocol}://${req.get('host')}${req.originalUrl}` ); const serverState = await getServerState(, { renderToString, }); const html = renderToString( ); res.send( ` React InstantSearch SSR
${html}
` ); }); app.listen(8080, () => { // eslint-disable-next-line no-console console.log('Listening on: http://localhost:8080'); });