Skip to main content
Module

x/udibo_react_app/server.tsx>AppRouterOptions

A React Framework for Deno that makes it easy to create highly interactive apps that have server side rendering with file based routing for both your UI and API.
Go to Latest
interface AppRouterOptions
import { type AppRouterOptions } from "https://deno.land/x/udibo_react_app@0.9.1/server.tsx";

An interface that represents the options for creating an App Router.

Type Parameters

optional
AppContext extends Record<string, unknown> = Record<string, unknown>

Properties

A react router route object. The build script will automatically generate this for your application's routes. The route object is a default export from _main.tsx in your routes directory.

optional
env: AppEnvironment

Default environment variables that you would like to share with the browser for all requests.

optional
providerFactory: (context: Context<AppState<AppContext>>) => ComponentType<{ children: ReactNode; }>

Creates a provider that wraps the entire application.

optional
Context: ReactContext<AppContext>

A context object for the App. State stored within the AppContext will be serialized and shared with the browser.

optional
renderToReadableStream: renderToReadableStream

A function used to render the application to a readable stream. If you'd like to transform the stream before it is returned to the client, you can wrap the default renderToReadableStream to pipe it through a transform stream.

For example, the following renderToReadableStream function uses the default function then pipe's it through a transform stream that adds a tailwindcss style sheet to the head of the HTML page using twind.

async renderToReadableStream(context: Context<AppState>) {
  return (await renderToReadableStream(context))
    .pipeThrough(new TwindStream(tw));
}
optional
router: Router

The Oak router for the application. The router object will be generated automatically for the application's routes. The object is the default export from the _main.ts file in the routes directory.

optional
workingDirectory: string

The working directory of the application. Defaults to the current working directory that the application is running from.

optional
devPort: number

The port for the dev script's live reload server.