Is there a fetch driver that uses no deps and just raw fetch?

Is there a fetch driver that uses no dependencies and just uses raw fetch for edge (vercel, cf workers, etc)? I don’t mind doing custom API calls to be lean. Is there documentation on rest api for getting page by slug/pathname and getting variants?

Hi @safe_sturgeon, for now the best thing to do is to fork the fetch component into your code base so that you can make it work the way you want on edge platforms - it’s very simple and is available here https://github.com/plasmicapp/plasmic/tree/master/plasmicpkgs/plasmic-query

I’d rather have no dependencies. Is that possible?

We’re evaluating between plastic and builder and builder so far works with minimal effort and a single query to match a path to a page

Hi @safe_sturgeon , I’m not sure I entirely follow.

If you simply want to issue a fetch from your application code and provide it to your plasmic design in the same way that Builder works for data fetching, then you can already do that. You don’t need to add any data fetching code components.

Do you have an example of what you were trying to achieve exactly?

Let me rephrase. We’re using astro.build with Vercel edge SSR. Which limits us on what we can do on the server rendering front. We have to use raw fetch. So what we’d like to do is have a catch all route that checks if plasmic has a page for that path, if so, render it (ideally it just spits out HTML, if not, at least supports edge SSR). These will be for landing pages so we want them lean.

Oh, sorry I completely misunderstood the original question for something more complicated.

You can use fetchPages and the plain REST API, as shown here—this ensures no additional scripts or dependencies are bundled into your final landing page:

---
const pages = await PLASMIC.fetchPages();
...
const content = await fetch('<https://codegen.plasmic.app/api/v1/loader/html/preview/PROJECTID/>' + pageName + '?hydrate=0&embedHydrate=0');
---

<div>{content.html}</div>

Let me know if that helps…

I’ll look into it soon thanks