Making REST calls to flask service running on different port
<p>I have two services running in <code>docker-compose</code>, <code>frontend</code> and <code>backend</code>, both developed using flask.</p>

<pre><code>frontend:
  restart: always
  build: ./frontend
  expose:
    - "8000"
  command: /usr/local/bin/gunicorn --bind :8000 run:application

backend:
  restart: always
  build: ./backend
  expose:
    - "9000"
  command: /usr/local/bin/gunicorn --bind :9000 run:application
</code></pre>

<p>I am hosting a simple REST API in the backend</p>

<pre><code>@app.route('/api/weather', methods=['GET'])
def get_weather():
    super_cool_function()
    return jsonify({'temperature': 100})
</code></pre>

<p>What is the best way to consume this API in frontend? I guess following is one way but I am not sure what should be the input to <code>requests.get()</code></p>

<pre><code>@app.route('/hello')
def hello():
    r = requests.get()
    return render_template('hello.html', temperature=r.json()['temperature'])
</code></pre>