var http = require(
'http');
var urllib = require(
'url');
var port =
10011;
var data = {
"dest_adcode":
110101, msg
": "ok
"};
http.createServer(function(req, res){
var params = urllib.parse(req.url,
true);
if (
params.query &&
params.query.cb) {
var str =
params.query.cb +
'(' + JSON.stringify(data) +
')';
//jsonp
res.end(str);
} else {
res.end(JSON.stringify(data));//普通的json
}
}).listen(port, function(){
console.log('server is listening on port ' +
port);
})
转载于:https://www.cnblogs.com/gengcjun/p/6404712.html
相关资源:JAVA上百实例源码以及开源项目
转载请注明原文地址: https://mac.8miu.com/read-17949.html