Skip to content

Commit 657949e

Browse files
authored
Fix production server handler (#45)
1 parent fb04949 commit 657949e

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

server/index.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import crypto from 'crypto'
2-
import { createRequestHandler } from '@react-router/express'
32
import { ip as ipAddress } from 'address'
43
import chalk from 'chalk'
54
import closeWithGrace from 'close-with-grace'
@@ -217,18 +216,8 @@ if (IS_DEV) {
217216
// Everything else (like favicon.ico) is cached for an hour. You may want to be
218217
// more aggressive with this caching.
219218
app.use(express.static('build/client', { maxAge: '1h' }))
220-
const build = await import(BUILD_PATH)
221-
app.all(
222-
/.*/,
223-
createRequestHandler({
224-
mode: MODE,
225-
build,
226-
getLoadContext: (_req, res) => ({
227-
cspNonce: res.locals.cspNonce,
228-
serverBuild: build,
229-
}),
230-
}),
231-
)
219+
const buildModule = await import(BUILD_PATH)
220+
app.use(buildModule.app)
232221
}
233222

234223
const desiredPort = Number(process.env.PORT || 3000)

0 commit comments

Comments
 (0)