Backan client
Create a client for your backan
API and make your frontend app able to access your API easily and with type. To achieve this, backan makes use of the openapi-featch
library.
🔑 Installation
bash
npm install @backan/client
bash
pnpm i @backan/client
bash
yarn add @backan/client
bash
bun add @backan/client
bash
deno add npm:@backan/client
📈 Usage
ts
import { createClient } from '@backan/client'
import type { paths } from './openapi.d.ts' // Types generated by `buildSchema` function from `@backan/builder`
const client = createClient<paths>( {
baseUrl : 'http://localhost:1312/',
} )
export {client}
Example of call
ts
import {client} from './client.js'
const response = await client.GET( '/random/child', {
params : {
query : {
value : 'myValue',
},
},
} )
console.log( response )