政务数据资源中心(Government data Resource center) 03专项3期主要建设内容
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
960 B

/**
* Created by PengLing on 2017/7/3.
*/
'use strict';
const request = require('superagent');
module.exports = {
entry: (app, router, opts) => {
const apiRoot = `${opts.host}${opts.match}`;
const req = {
get: (url) => {
return request.get(`${apiRoot}${url}`);
},
post: (url, data) => {
return request
.post(`${apiRoot}${url}`)
.set('Content-Type', 'application/json')
.send(data);
},
put: (url, data) => {
return request
.put(`${apiRoot}${url}`)
.set('Content-Type', 'application/json')
.send(data);
},
delete: (url) => {
return request.del(`${apiRoot}${url}`);
}
};
app.iota = app.iota || {};
app.iota.request = req;
}
};