Git Product home page Git Product logo

vapor-sdk's Introduction

Vapor SDK Wrapper

Vapor SDK Wrapper is a flexible and robust library for interacting with APIs. It provides support for JWT authentication, dynamic routing, response transformation, enhanced logging, and more.

Table of Contents

Installation

Install the package using NPM:

npm install vapor-sdk

Features

  • JWT Authentication: Secure your API requests with JSON Web Token (JWT) authentication.
  • Dynamic Routing: Define endpoints dynamically based on your use cases.
  • Response Transformation: Handle common data manipulation tasks with built-in transformation functions.
  • Enhanced Logging: Get detailed insights into requests and responses, including headers, body, and timing information.
  • Session Login: Authenticate and manage sessions with a dedicated login method.

Usage

Initialization

Create a new instance of VaporWrapper:

import VaporWrapper from 'vapor-sdk';

const vapor = new VaporWrapper({
    baseURL: 'https://api.example.com',
    maxRetries: 5,
    logger: console,
    timeout: 1000,
});

Session Login

Authenticate using the session login method:

vapor.login('/login', 'username', 'password');

Fetching Data

Fetch data with optional JWT authentication and response transformation:

vapor.fetchData('/data', 'your-jwt-token', (data) => data.map(item => item.value));

Custom Routes

Make custom API requests with optional JWT authentication:

vapor.route({
    method: 'get',
    route: '/users',
    token: 'your-jwt-token',
});

Examples

See the examples directory for more detailed examples and use cases.

Changelog

See the changelog for a detailed history of changes and updates.

Contributing

We welcome contributions! See the contributing guide for details on how to contribute.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.