tinejs
v0.1.42
Published
Yet another typescript framework
Downloads
196
Readme
tinejs
edge framework for nextJs
example:
useCases/hello/index.ts
import { z } from 'zod';
import { tineVar, tineInput, shape } from 'tinejs';
const input = tineInput(z.object({ name: z.string().nullable() }));
const hello = shape({
params: tineVar(input, ({ name }) => `Hello ${name || 'World'}`)
});
export default hello.withInput(input);
usage:
'use client';
import useSWR from 'swr';
import { UseCases } from '@/useCases';
export default function Page() {
const { data } = useSWR(...UseCases.hello.input({ name: 'Earth' }));
return <pre>{JSON.stringify(data, null, '\t')}</pre>;
}