Prerequisites
🚀 Feature Proposal
May be there is some way to accept fastify instance to NextRequest, then got it from getServerSideProps context, save it on page params and then use fastify.inject instead of fetch or axios?
I suppose it should be faster than ku_universal, axois and other libraries calls, but do not exactly understand how to pass fastify instance in render function.
I have an idea to extends RawRequest interface like
declare module 'fastify' {
interface RawRequest {
server: FastifyInstance
}
}
then give instance in gccp objects requests like :
server.next(`/log-in`, async (app:NextServer, req:FastifyRequest, reply:FastifyReply) => {
// here we potentialy can accept fastify instance to req.raw
raw.req.server = server
await app.render(req.raw, reply.raw, '/log-in')
reply.hijack()
})
and finally got ot from props
export const getServerSideProps: GetServerSideProps = async (context) => {
const data = {server: context.req.server}
return { props: { data } }
}
But unfortunatly there is no RawRequest interface in Fastify types.
Prerequisites
🚀 Feature Proposal
May be there is some way to accept fastify instance to NextRequest, then got it from getServerSideProps context, save it on page params and then use fastify.inject instead of fetch or axios?
I suppose it should be faster than ku_universal, axois and other libraries calls, but do not exactly understand how to pass fastify instance in render function.
I have an idea to extends RawRequest interface like
then give instance in gccp objects requests like :
and finally got ot from props
But unfortunatly there is no RawRequest interface in Fastify types.