Skip to content

Commit

Permalink
remove short circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis committed Mar 2, 2024
1 parent 9d3218c commit 7ac0eb6
Showing 1 changed file with 30 additions and 34 deletions.
64 changes: 30 additions & 34 deletions packages/houdini/src/runtime/router/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,39 @@ export function _serverHandler<ComponentType = unknown>({
return yoga(request)
}

return new Response('OK', { status: 200 })
// maybe its a session-related request
const authResponse = await handle_request({
url,
config: config_file,
session_keys,
headers: request.headers,
})
if (authResponse) {
return authResponse
}

// the request is for a server-side rendered page

// find the matching url
const [match] = find_match(manifest, url)

// call the framework-specific render hook with the latest session
const rendered = await on_render({
url,
match,
session: await get_session(request.headers, session_keys),
manifest,
componentCache,
})
if (rendered) {
return rendered
}

// if we got this far its not a page we recognize
return new Response('404', { status: 404 })
}
}

// // // maybe its a session-related request
// // const authResponse = await handle_request({
// // url,
// // config: config_file,
// // session_keys,
// // headers: request.headers,
// // })
// // if (authResponse) {
// // return authResponse
// // }

// // // the request is for a server-side rendered page

// // // find the matching url
// // const [match] = find_match(manifest, url)

// // // call the framework-specific render hook with the latest session
// // const rendered = await on_render({
// // url,
// // match,
// // session: await get_session(request.headers, session_keys),
// // manifest,
// // componentCache,
// // })
// // if (rendered) {
// // return rendered
// // }

// // // if we got this far its not a page we recognize
// // return new Response('404', { status: 404 })
// // }
// }

export const serverAdapterFactory = (
args: Parameters<typeof _serverHandler>[0]
): ReturnType<typeof createAdapter> => {
Expand Down

0 comments on commit 7ac0eb6

Please sign in to comment.