Next.js Discord

Discord Forum

Python with Nextjs

Unanswered
WOLFLEADER posted this in #help-forum
Open in Discord
Hey,

I am using the t3 stack and trying to setup a fastapi inside of it as i need it for some ML stuff.

I came across this
https://github.com/digitros/nextjs-fastapi
however it only works with app dir.

Ideally i dont wont unrestricted access to this api either, i want to try limit its access to only being used from internally via trpc.

I have tried
  rewrites: async () => {
    return [
      {
        source: "/api/py/:path*",
        destination:
          process.env.NODE_ENV === "development"
            ? "http://127.0.0.1:8000/api/:path*"
            : "/api/py",
      },
    ];
  },



however when i go to localhost:3000/api/py it doesnt redirect me

0 Replies