How to point to /graphql endpoint served from a different app instead?

I have an existing backend written in Laravel (PHP, MySQL, and Lighthouse GraphQL).

I want to create a frontend project using RedwoodJs and somehow configure it to point to the /graphql endpoint of my Laravel project on a different domain (rather than use the /graphql endpoint built in to this RedwoodJs project).

How can I do this?

Thanks!

Hi @ryancwalsh Would it be possible to just connect directly to the MySQL DB using Prisma? If so, you can use Prisma Introspection to create the schema.

If you wanted to connect to the Lighthouse GraphQL from the Redwood Web side, you’d need to look at how Redwood implements the Apollo Client here in index.js from the @redwoodjs/web package. You can set the ‘apiProxyPath’ accordingly in redwood.toml, but you’d need to also make some changes to Webpack as it aliases this path for local dev in webpack.development. Last thought on this approach, you can completely delete the api/ directory and Redwood dev-server and build will work fine.

Final idea, you could you approach this like a 3rd party API. This feels like it adds the most redundancy, but it might be the most straightforward.

1 Like

Thank you so much for these great suggestions, @thedavid! You are amazing. :smile:

1 Like