Open History to see the last commit
1import express from 'express'
2import { toNodeHandler } from 'srvx/node'
3β
4const PORT = Number.parseInt(process.env.PORT || '3000')
5β
6const app = express()
7β
8const { default: handler } = await import('./dist/server/server.js')
9const nodeHandler = toNodeHandler(handler.fetch)
10β
11// Serve built client assets at /_ui/ prefix
12app.use('/_ui', express.static('dist/client'))
13β
14// All other requests go through the SSR handler
15app.use(async (req, res, next) => {
16 try {
17 await nodeHandler(req, res)
18 } catch (error) {
19 next(error)
20 }
21})
22β
23const httpServer = app.listen(PORT, (error) => {
24 if (error) {
25 throw error
26 }
27 console.log(`E2E app: http://localhost:${httpServer.address().port}`)
28})