Is the Local API not intended for use by FE applications?
Or am I just holding it wrong?
The listed common use cases don't include it but the "tip" on the documentation page says
The Local API is incredibly powerful when used with server-side rendering app frameworks like NextJS.
I'm running the following inside of the
getServerSideProps
of a page:
await payload.init({
secret: process.env.PAYLOAD_SECRET ?? '',
mongoURL: process.env.MONGODB_URI ?? '',
local: true,
});
And I'm getting a
cannot find Payload config.
Edit: my payload code and fe/next code are in separate repos so the config isn't "near by"
You will need the config in order to boot up payload. So if you
reallywanted to use the local api you would have to copy it over. The docs are mainly referring to scenarios where the FE/BE are colocated.
In your case though, I would probably save myself the hassle of copying configs, and make fetch requests to your hosted payload api endpoints.
Yeah it makes sense, kinda figured I'd need to provide the collections/globals at the very least. Thanks 😄
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.