express - Express + Axios - Pipe request to another server
问题描述
With express and request, piping a request to another server and responding with its response was as simple as
router.get('/', (req, res, next) => {
req
.pipe(request.get(`https://some_url/${req.path}`))
.pipe(res);
}
What is the equivalent of this using axios? simply replacing request with axios results in
(node:17672) UnhandledPromiseRejectionWarning: TypeError: dest.on is not a function
解决方案
推荐阅读
- typescript - 如何将 json 对象转换为 ReadOnlyMap
在打字稿中 - c# - .net core 3.0 预览版中的 Windows 窗体(桌面)应用程序未与 .net core 3.0 运行时版本一起运行
- python - 从日期时间转换为纪元时间(时区感知)
- amazon-s3 - 如何从 AWS Glue DF 将 csv 文件保存到具有指定名称的 AWS S3?
- java - 没有 Spring 上下文的集成测试
- wai-aria - jquery blockUI 插件中的可访问性支持
- ruby-on-rails - Rails:使用respond_to而不响应
- python - 如何使用 python 和绑定文件连接到 mq 队列?
- python - 从列表中创建组合而不考虑相邻元素
- php - 如何在 3 个条件下添加 where