Last week was a bit different — I started and finished my trailer driving license in one week!
Didn't have much time for new projects, but I've included a useful Nuxt tip on how to fetch data from the server before your app starts. Hope you find it helpful!
👉🏻 A tiny Nuxt module to make using the Workers API type-safe and automatic within your apps.
👉🏻 Zero-config - just drop files in a `workers/``workers/` directory
👉🏻 Isomorphic - works server + client
👉🏻 Fully typed
👉🏻 Auto-imported
💡 Nuxt Tip: Fetch Data from the Server Before App Start
In configuration driven applications it's a common requirement to load a configuration from an API before the app starts. In these scenarios you usually want to fetch the data on the server to avoid leaking the endpoint URL or API key to the client.
In Nuxt 3+ you can achieve this by using a server plugin (plugins/init.server.tsplugins/init.server.ts) and providing the data in the Nuxt payload:
With the filename suffix .server.ts.server.ts we tell Nuxt to run this plugin only on the server. The plugin fetches the configuration from the API and adds it to the Nuxt payload. You can then access the configuration in your components like this:
1<script setup lang="ts">2const nuxtApp = useNuxtApp();34const user = nuxtApp.payload.data.userData;5</script>
Try it yourself in the following StackBlitz example:
Sunday, January 5, 2025 Update: Bluesky images work again and thus the Great Art on Bluesky channel is back. If you're on Bluesky please subscribe. # The crazy thing about Bluesky's API is they took already standardized things like links and enclosures, and after 20+ years came up with new definitions. Makes our apps more expensive to maintain, and we waste time and human wear and tear on stupid bullshit make-work. Developers are people, and our work is already horribly overly complex, we're working at the edge of comprehension, and what the fukc let's throw some more unnecessary complication into the mix. Arrogance, narcissism, whatever the source is, it's not a good way to introduce yourself. And, even better, after you go through the maze they break it, with an error message about legacy blob bullshit. They've already done this, and they're just getting started. It's why I say they should just adapt to RSS instead of trying to forc...
评论
发表评论