react_server_shelf 0.1.1 copy "react_server_shelf: ^0.1.1" to clipboard
react_server_shelf: ^0.1.1 copied to clipboard

Shelf integration for React Dart server applications.

react_server_shelf #

Optional Shelf integration for react_server. It handles server-function requests, SSR documents, and static fallback without adding Shelf to the portable server package.

Installation #

dependencies:
  react_server: ^0.1.0
  react_server_shelf: ^0.1.0
  shelf: ^1.4.0

Application handler #

final app = ReactServerApp(
  actionRegistry: actionRegistry,
  staticHandler: staticHandler,
  indexTemplate: indexTemplate,
  ssr: ReactSsrClient(endpoint: Uri.parse(ssrUrl)),
  rootComponent: 'package:my_app/lib/app.dart#App',
  pageProps: (request) => {'path': request.requestedUri.path},
);

final server = await shelf_io.serve(app.handler, '0.0.0.0', 8080);

ReactServerApp routes /__react/actions to generated server functions, renders application documents through the SSR client, and delegates asset requests to the supplied Shelf handler.

Use createServerActionHandler when integrating only the action endpoint into an existing Shelf pipeline.

Testing #

Compose the real handler with ShelfRequestHandler from server_testing_shelf and use ReactTestHarness for built assets and the Node worker. This keeps tests on the same application path used in production.

0
likes
130
points
134
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Shelf integration for React Dart server applications.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

react_actions, react_server, shelf

More

Packages that depend on react_server_shelf