小编Ori*_*rit的帖子

Google Places API - 我可以保存place_id吗?

我们开发了一个建立旅行路线的平台.旅行计划(=旅程)由用户定义的流量排序的地点组合.我们希望使用Google Places API搜索地点.我们想存储一个place_id,并用它来检索旅行信息.place_id将用于从Google获取该地点的详细信息.只有当用户决定将该地点包含在他的旅行行程中时,才会保存place_id以供将来使用.

是否允许根据使用条款?

谢谢!奥里特

google-places-api

9
推荐指数
2
解决办法
1483
查看次数

Node.js http-proxy:错误响应未发送到客户端

我正在使用 proxy.web 转发客户端请求。当目标服务器启动时,我的代码将按预期工作。当目标服务器关闭时,ECONNREFUSED 错误将被捕获并打印到 console.log。我想将该错误发送回客户端,并尝试使用此处提供的示例。不幸的是,错误响应没有到达客户端(尝试了 chrome 和 firefox)。请找到下面的代码。为什么响应没有发送到客户端?

var proxyServer = http.createServer(function(req, res) {

if(req.path === 'forbidden') {
    return res.end('nope');
}

var url_parts = url.parse(req.url);
var extname = path.extname(url_parts.pathname);

    if (extname || url_parts.pathname.length <= 1){
        proxy.web(req, res, {
            target: 'http://localhost:'+config.fileServer.port
        });
    }
    else{
        proxy.web(req, res, {
            target: config.recognitionServer.url
        }, function(e) {
            console.log(e.message);
            if (!res.headersSent) {
                res.writeHead(500, { 'content-type': 'application/json' });
            }
            res.end(JSON.stringify({ error: 'proxy_error', 
                   reason: e.message         
            }));
        });
    }

 }).listen(config.proxyServer.port, function () {
    console.log('Proxy server is listening on port ' …
Run Code Online (Sandbox Code Playgroud)

http-proxy node.js

5
推荐指数
1
解决办法
3992
查看次数

标签 统计

google-places-api ×1

http-proxy ×1

node.js ×1