1.1.1 • Published 6 months ago

@randajan/api-kit v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@randajan/api-kit

NPM JavaScript Style Guide

JavaScript library for rendering structured data in HTML format. It supports automatic detection of tabular structures and visualization of deeply nested objects. It is ideal for debugging, admin interfaces, or displaying API responses.

Installation

Usage

Server

You can use the library as an ES module:

import createApi from "@randajan/api-kit/server";

const apiReponder = ({
    code:0,
    isAsync:false,
    timestamp:false,
    trait:(opt)=>opt,
    onOk:(resp, opt)=>{},
    onError:(resp, opt)=>{ },
    throwError:false
});

Client

You can use the library as an ES module:

import createFetch from "@randajan/api-kit/client";

const apiFetch = createFetch({
    code:0,
    url:"",
    fetch:globalThis.fetch,
    query:{},
    parseHeaders:false,             //if true it will parse response headers
    resultOnly:false,               //if true it will return only result
    timestamp:false,                //if true it will calculate timestamps
    parseBody:(body)=>body,         //custom parser for non api-kit server fetches only
    trait:(opt)=>opt,
    onOk:(resp, opt)=>{},
    onError:(resp, opt)=>{ },
    throwError:false
});

Support

If you have any questions or suggestions for improvements, feel free to open an issue in the repository.

License

MIT © randajan

1.1.1

6 months ago

1.1.0

6 months ago

1.0.12

7 months ago

1.0.11

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago