@react-foundry/fastify-react-router
v0.1.7
Published
Fastify plugin for React Router.
Readme
React Foundry - Fastify-React-Router
Fastify plugin for React Router.
Using this package
First install the package into your project:
npm install -S @react-foundry/fastify-react-routerThen use it in your code as follows:
import Fastify from '@react-foundry/fastify';
import fastifyReactRouter from '@react-foundry/fastify-react-router';
const httpd = Fastify({});
await httpd.register(fastifyReactRouter, {
assets: join(import.meta.dirname, 'path', 'to', 'build', 'of', 'client'),
serverBuild: await import('path/to/build/of/server/index.js')
});
await httpd.listen({ port: 8080 });It is expected that you will have built the referenced files with
react-router build.
Dev server
You can use the /dev entrypoint for a dev server.
import Fastify from '@react-foundry/fastify';
import fastifyReactRouterDev from '@react-foundry/fastify-react-router/dev';
const httpd = Fastify({});
await httpd.register(fastifyReactRouterDev);
await httpd.listen({ port: 8080 });Working on this package
Before working on this package you must install its dependencies using the following command:
pnpm installBuilding
Build the package by compiling the source code.
npm run buildClean-up
Remove any previously built files.
npm run clean