1.3.1 • Published 3 years ago

bungee-client v1.3.1

Weekly downloads
380
License
ISC
Repository
github
Last release
3 years ago

Bungee Client

bungee-client is a wrapper for the bungee-server web apis. The client manages domain routing, implements request retries, and parses resposnes for ease of use, among other functions.


Installation

npm install bungee-lib

Usage Example

Together with bungee-lib/environment you can make requests to your bungee cluster in the following manner

const { rest } = require('./rest');
const { environment } = require('bungee-lib');

const test = async () => {
   
    // Create new items
    const create_response = await rest.create({
        model: environment.vars.USERS,
        item: {
            name: "test",
            email: "test"
        }
    });
    const new_user = create_response.data;

    // Fetch item by id
    const retrieve_user_response = await rest.retrieve({
        model: environment.vars.USERS,
        id: new_user.id
    });
    const retrieved_user = retrieve_user_response.data;
    
    // Update an item
    new_user.name = 'updated name';
    const update_response = await rest.update({
        model: environment.vars.USERS,
        item: new_user
    });

    // Destroy an item
    const destroy_response = await rest.destroy({
        model: environment.vars.USERS,
        id: new_user.id
    });
    const destroy_success = destroy_response.data === 1;
   
};

test();
1.3.1

3 years ago

1.3.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.0

3 years ago