-
Specifically, I have a catch-all route at the end. app.all('*', async (request, reply) => {
try {
const handler = createRequestHandler({
// https://github.com/remix-run/remix/issues/8343#issuecomment-1867179525
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore - expected type mismatch
build: () => vite.ssrLoadModule('virtual:remix/server-build'),
});
return handler(request, reply);
} catch (error) {
return reply.status(500).send(error);
}
}); I want to remove content-parser just for this route, i.e.
I need this to make Fastify compatible with Vite/Remix setup: mcansh/remix-fastify#244 |
Beta Was this translation helpful? Give feedback.
Answered by
matthyk
Feb 7, 2024
Replies: 1 comment 1 reply
-
Encapsulate your catch-all route within a plugin and remove all content-type parsers. export default function (app) {
app.removeAllContentTypeParsers()
app.all('*', async (request, reply) => {
try {
const handler = createRequestHandler({
// https://github.com/remix-run/remix/issues/8343#issuecomment-1867179525
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore - expected type mismatch
build: () => vite.ssrLoadModule('virtual:remix/server-build'),
});
return handler(request, reply);
} catch (error) {
return reply.status(500).send(error);
}
});
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
adaboese
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Encapsulate your catch-all route within a plugin and remove all content-type parsers.