{"repo":"wobsoriano/nuxt-remote-fn","free":true,"listed":false,"github":"https://github.com/wobsoriano/nuxt-remote-fn","clone":"git clone https://github.com/wobsoriano/nuxt-remote-fn.git","description":"Remote Functions. Instead of Event Handlers.","language":"TypeScript","stars":108,"topics":["api","http","nuxt","proxy","vue"],"license":null,"category":"networking-infra","readme_excerpt":"nuxt-remote-fn nuxt-remote-fn allows you to call your backend-functions from the frontend, as if they were local. No need for an extra language or DSL to learn and maintain. Install Usage Export your remote functions in .remote.{ts,js,mjs} files: Directly use any SQL/ORM query to retrieve & mutate data on client. The .remote part of the filename informs the module that this code should never end up in the browser and to convert it to an API call instead ( POST /api/ remote/todo/getTodos ). Checkout the playground example. H3 Event The useH3Event hook provides the event object of the current request. You can use it to check headers, log requests, or extend the event's request object. You can use all built-in h3 utilities inside your exported functions. createContext Each .remote. file can also export a createContext function that is called for each incoming request: useAsyncData nuxt-remote-fn can work seamlessly with useAsyncData : Fetch options: Since nuxt.config.ts file doesn't accept functions as values, you can use the client directly to add $fetch options: Why this module Sharing data from server to client involves a lot of ceremony. i.e. an eventHandler needs to be set up and useFetch needs to be used in the browser. Wouldn't it be nice if all of that was automatically handled and all you'd need to do is import getTodos on the client, just like you do in eventHandler 's? That's where nuxt-remote-fn comes in. With nuxt-remote-fn , all exported functions from .server. fil","default_branch":null,"files":null,"tree":[],"storefront":"/r/wobsoriano","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/wobsoriano/nuxt-remote-fn/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}