diff --git a/packages/houdini/src/runtime/router/server.ts b/packages/houdini/src/runtime/router/server.ts index 3f668cf07..0ab15ec5f 100644 --- a/packages/houdini/src/runtime/router/server.ts +++ b/packages/houdini/src/runtime/router/server.ts @@ -74,43 +74,39 @@ export function _serverHandler({ 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[0] ): ReturnType => {