How can I return a valid JSON response with React-Router and an Express backend?

前端 未结 1 355
暖寄归人
暖寄归人 2021-01-26 05:41

I have a setup similar to the one in this tutorial. How can I render JSON alone (no HTML) without having to specify the port number for the route specified in index.js

相关标签:
1条回答
  • 2021-01-26 06:00

    Rewriting the URL before passing it upstream within Nginx solved my problem:

    location / {
        rewrite ^/u/(.*)$ /actors/$1 last;
        proxy_pass http://localhost:5000;
    }
    
    0 讨论(0)
提交回复
热议问题