diff --git a/apiProxyMiddleware.js b/apiProxyMiddleware.js index f049c1db..f0c34fc4 100644 --- a/apiProxyMiddleware.js +++ b/apiProxyMiddleware.js @@ -1,13 +1,12 @@ -import request from 'request' +const request = require('request') function apiProxyMiddleware (req, res, next) { - if (true) { // is application/json + if (!req.xhr) { return next() } - console.log(req.get('Content-Type')) const method = req.method.toLowerCase() req.pipe( - request[method](url, { + request[method](process.env.API + req.originalUrl, { headers: { ...req.headers, host: process.env.API @@ -18,4 +17,4 @@ function apiProxyMiddleware (req, res, next) { .pipe(res) } -export default apiProxyMiddleware \ No newline at end of file +module.exports = apiProxyMiddleware \ No newline at end of file diff --git a/public/index.html b/public/index.html index 86d8a5aa..230c865d 100644 --- a/public/index.html +++ b/public/index.html @@ -71,6 +71,7 @@