1.0.6 • Published 4 months ago

t-http v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

t-http

Project setup

npm install t-http --save-dev;
or
yarn install t-http --save-dev;

Syntax

t = new Date().valueOf();

GET:
    params: 
        type: Object
    exp: 
        { page: 1, size: 10 }
        /api/demo?page=1&size=10&t=t

GETQUERY:
    params: 
        type: Object
    exp: 
        { page: 1, size: 10 }
        /api/demo/1/10?t=t

POST:
    params: 
        type: Object
    exp: 
        { page: 1, size: 10 }
        /api/demo?t=t

PUT:
    params: 
        type: Object
    exp: 
        { page: 1, size: 10 }
        /api/demo?t=t

DELETE:
    params: 
        type: Object
    exp: 
        { page: 1, size: 10 }
        /api/demo?t=t

Cite

mkdir demo.js

import apiFactory from 't-http';

const demo = [
    {
        name: 'demoList',
        url: '/demo/list',
        method: 'post'
    }
];

export default apiFactory(demo);

Employ

import demoApi from '***/demo.js';
let params = { page: 1, size: 10 };
let { data, code } = await demoApi.demoList(params);
if(code === 0){
    //  To Do Somethings
}

Customize configuration

See API.

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago