Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
nitedani committed Aug 11, 2024
1 parent f820c68 commit e046d7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/hono-react-vercel-edge/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ npm run dev

Deploy the example using [Vercel](https://vercel.com):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vikejs/vike-node/tree/main/examples/hono-react-vercel-edge&project-name=hono-react&repository-name=hono-react)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vikejs/vike-node/tree/vercel-edge/examples/hono-react-vercel-edge&project-name=hono-react&repository-name=hono-react)
24 changes: 11 additions & 13 deletions packages/vike-node/src/runtime/handler-web.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { assert } from '../utils/assert.js'
import { isNodeLike } from '../utils/isNodeLike.js'
import { globalStore } from './globalStore.js'
import { VikeOptions, WebHandler } from './types.js'
// import { isNodeLike } from '../utils/isNodeLike.js'
import type { VikeOptions, WebHandler } from './types.js'
import { renderPage } from './vike-handler.js'

export function createHandler<PlatformRequest>(options: VikeOptions<PlatformRequest> = {}) {
Expand All @@ -12,15 +10,15 @@ export function createHandler<PlatformRequest>(options: VikeOptions<PlatformRequ
if (request.method !== 'GET') {
return undefined
}
nodeLike ??= await isNodeLike()
if (nodeLike) {
if (!nodeHandler) {
const connectToWeb = (await import('./adapters/connectToWeb.js')).connectToWeb
const handler = (await import('./handler.js')).createHandler(options)
nodeHandler = connectToWeb((req, res, next) => handler!({ req, res, platformRequest, next }))
}
return nodeHandler(request)
}
// nodeLike ??= await isNodeLike()
// if (nodeLike) {
// if (!nodeHandler) {
// const connectToWeb = (await import('./adapters/connectToWeb.js')).connectToWeb
// const handler = (await import('./handler.js')).createHandler(options)
// nodeHandler = connectToWeb((req, res, next) => handler!({ req, res, platformRequest, next }))
// }
// return nodeHandler(request)
// }

const httpResponse = await renderPage({
request,
Expand Down

0 comments on commit e046d7b

Please sign in to comment.