You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But in short, I think the best way to do this is to add a +middleware.js early on, that appends your database connector to context aka $global, using something like context.dbClient = dbClient. This way, you only ever need to create +page.marko with <await($global.dbClient.find(...))> and don't have to litter your code with +handler.js everywhere.
Let's say I want to fetch products from the database.
that's the old way:
What's the proper way to do the same in marko/run?
I tried something like this in +handler.js
and then in +page.marko
<h1>${$global.platform.response.locals.data}</h1>
but i'm not sure it's the best way.
The text was updated successfully, but these errors were encountered: