apizy
v0.2.9
Published
A robust library designed for seamless communication between a Node.js backend and a JavaScript frontend.
Readme
apizy
A robust library designed for seamless communication between a Node.js backend and a JavaScript frontend, crafted with TypeScript in mind to ensure no data detail is missed between the two.
Check out the DOCUMENTATION
Define your API endpoints as simple, as:
import { object, string, optional, arrayOf, uuid } from 'apizy';
api.createMethod(
'articles.create', // <-- Name of the method
object({ // <-- Input data
title: string(),
content: string(),
tags: optional(arrayOf(string())),
}),
object({ // <-- Output data
id: uuid(),
url: string(),
}),
async (input) => { // <-- Handler
// ...
return { id, url };
},
);Use it on frontend as simple as:
sdk.articles.create({title: '...', content: '...'})