boywithkeyboard / bunny.net

JavaScript SDK for πŸ‡ bunny.net

Home Page:https://npmjs.com/bunny.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bunny.net(.js)

Setup

Deno

import { Client } from 'https://esm.sh/bunny.net'

Node.js

npm i bunny.net
import { Client } from 'bunny.net'

Usage

Important

You need to open a bunny.net account first to use this module. After you have signed up, you can get your API token here.

const bunny = new Client({
  token: '...'
})

Guide

Error Handling

All functions return an object with the data and error properties. The error property is either true or false, depending on the status code of the response.

If the error property is false, you can access the response data in the data property.

const { data, error } = await bunny.method()

if (!error) {
  // do smth with response data
} else {
  // handle error
}

Debugging

If you encounter issues, you should enable debug mode.

new Client({
  debug: true
})

If the response from the API is erroneous, the response body is printed out on the console in addition to the behavior described above.

About

JavaScript SDK for πŸ‡ bunny.net

https://npmjs.com/bunny.net

License:Apache License 2.0


Languages

Language:TypeScript 100.0%