ES6 & import * & import default & import JSON
import json & default value bug
api.json
{
"attention": {
"add": "/isv/duck/app/user/attention/add"
}
}
apis.js
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description APIs
* @augments
* @example
* @link
*
*/
import * as API from "./api.json";
// let log = console.log;
// log(`API =`, JSON.stringify(API, null, 4));
const APIs = API || {};
export default APIs;
export {
APIs,
};
ip.json
{
"test": "http://1.110.18.184:8080",
"dev": "http://1.110.18.184:8080",
"development": "http://1.110.18.184:8080",
"preview": "",
"production": ""
}
ips.json
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description IPs
* @augments
* @example
* @link
*
*/
// import * as IP from "./ip.json";
import IP from "./ip.json";
let log = console.log;
log(`IP =`, JSON.stringify(IP, null, 4));
const IPs = IP || {};
export default IPs;
export {
IPs,
};
testing
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description addAttention 添加关注(包含企业,领域)
* @augments POST /isv/duck/jintan/user/attention/add
* @example
* @link
*
*/
import IPs from "./ips.js";
import APIs from "./apis.js";
// import {IPs} from "./ips.js";
// import {APIs} from "./apis.js";
const addAttention = (datas = [], debug = false) => {
let result = ``;
// do something...
let log = console.log;
// let error = console.error;
log(`IPs =`, JSON.stringify(IPs, null, 4));
log(`APIs =`, JSON.stringify(APIs, null, 4));
return result;
};
export default addAttention;
export {
addAttention,
};
ES6 Destructor
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description IPs
* @augments
* @example
* @link
*
*/
import IP from "./ip.json";
// const IPs = IP || {};
let {
dev,
} = IP;
const IPs = {
dev,
};
export default IPs;
export {
IPs,
};
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description IPs
* @augments
* @example
* @link
*
*/
import IP from "./ip.json";
// const IPs = IP || {};
let {
dev,
} = IP;
const IPs = {
dev,
};
const IP_DEV = dev;
export default IPs;
export {
IPs,
IP_DEV,
};
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description IPs
* @augments
* @example
* @link
*
*/
import IP from "./ip.json";
// const IPs = IP || {};
let {
dev,
app,
} = IP;
const IPs = {
dev,
app,
};
const IP_DEV = dev;
const IP_APP = app;
export default IPs;
export {
IPs,
IP_DEV,
IP_APP,
};
apis
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description APIs
* @augments
* @example
* @link
*
*/
import API from "./api.json";
let {
attention,
search,
} = API;
const API_Attention = attention;
const API_Search = search;
const APIs = API || {};
export default APIs;
export {
APIs,
API_Attention,
API_Search,
};
{
"attention": {
"add": "/isv/duck/app/user/attention/add"
},
"search": {
"get": "/isv/duck/app/search/get",
"post": "/isv/duck/app/search/post"
}
}
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!