Introduction
Custom query builder to interact with the VNDB database via its HTTPS API.
Installation
sh
npm i @tb-dev/vndb
sh
pnpm add @tb-dev/vndb
sh
yarn add @tb-dev/vndb
sh
bun add @tb-dev/vndb
Prerequisites
This package can be used in any JavaScript environment, such as browsers and Node.js, as long as it supports JavaScript Proxies.
Usage
This is a simple example of how to use it to search for a visual novel by its ID:
ts
import { QueryBuilder, VNDB } from '@tb-dev/vndb';
const fields = ['title', 'image.url'];
const query = new QueryBuilder({ fields });
// Same as ['id', '=', 'v30168']
query.f('id').eq.v('v30168');
const vndb = new VNDB();
const { results } = await vndb.post.vn(query);
console.log(results);
TypeScript
Thanks to TypeScript, it provides detailed typing for each enpoint, drastically reducing the need to consult documentation.