小编moh*_*han的帖子

如何修复URI未在ClientProtocolException中指定有效的主机名:

嗨当我使用jest客户端执行弹性搜索java API时,我面临以下错误

org.apache.http.client.ClientProtocolException:URI未指定有效的主机名:localhost:9200/index/type/_search

我尝试各种可能性来解决这个错误,但它不会有任何人指导我解决这个问题吗?.提前谢谢.

java elasticsearch jest

12
推荐指数
1
解决办法
1万
查看次数

在nodejs中使用路径变量,在nodejs中使用查询值

我正在使用node.js中的express框架.我想访问路径变量和查询参数.当我只使用路径变量它工作正常,但使用查询参数它将无法工作建议我在单个API中使用正确的解决方案.在这里我提到代码.

app.get('/user/:id', function (req, res, next) {
    var url_parts = url.parse(req.url, true);
    var type = url_parts.params.id;
    Console.log('ID:', type);
    next();
}, function (req, res, next) {
    res.send('User Info');
});
Run Code Online (Sandbox Code Playgroud)

node.js express

0
推荐指数
1
解决办法
1088
查看次数

标签 统计

elasticsearch ×1

express ×1

java ×1

jest ×1

node.js ×1