Proxy Service
Understand how to set up a proxy service that integrates Parcel's front-end development server with a Flask back-end using Express.js and http-proxy-middleware. Explore routing requests between front-end and back-end, configuring scripts, and streamlining web app communication.
We'll cover the following...
Setting up the proxy server
Since the development web server built into the Parcel bundler does not currently support acting as a proxy for another web service such as Flask on its own, we need to utilize a web server that can support that capability. The Express.js web framework for Node.js fits this requirement nicely and is very lightweight. Along with that, we will also utilize the http-proxy-middleware JavaScript library, which lets us cleanly integrate with the Parcel web server.
Most of the time, our back-end web server will have some kind of a RESTful API that accepts a request from a web client and responds by sending back JSON data. One assumption we will make is ...