Accessing context and env during entry.server.tsx #1338
-
I am a bit confused about the relation between server.ts and entry.server.ts and couldn't find the appropiate documentation to clear this up:
|
Beta Was this translation helpful? Give feedback.
Answered by
juanpprieto
Sep 13, 2023
Replies: 1 comment 2 replies
-
👋🏼 @magnattic You can access the server.ts context via the handleRequest // entry.server.ts
import type {EntryContext, AppLoadContext} from '@shopify/remix-oxygen';
import {RemixServer} from '@remix-run/react';
import isbot from 'isbot';
import {renderToReadableStream} from 'react-dom/server';
export default async function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext,
loadContext: AppLoadContext,
) {
console.log('loadContext === server.ts context', loadContext);
// ... other code
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
magnattic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👋🏼 @magnattic
You can access the server.ts context via the handleRequest
loadContext
property