首页 > 解决方案 > 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

标签: expressaxios

解决方案


推荐阅读