πŸ§™β€β™‚οΈServer actions

With @atomico/vite, you will be able to use server-side functions in an environment-agnostic way, suitable for certain serverless and edge environments.

Thanks to the use of @atomico/vite, you will be able to create applications without worrying about servers. The goal is simple: transform the JS/TS resources in the src/api folder into serverless or edge functions. The frontend can then import these functions, and internally, the function will perform the fetch to the serverless or edge service.

Example with Cloudflare.

import type { Props } from "atomico";
import { getUserById } from "./api";

function app({id}: Props<typeof app>){
    const user = useAsync(()=>getUserById({id}),[id]);
    return <host>
        {user.name} - {user.phone}
    </host>
}

app.props = { id: Number }

Last updated