cheesy_pete
cheesy_pete
RRailway
Created by cheesy_pete on 6/1/2023 in #✋|help
Access services inside a project without exposing to internet
I have 2 backend services in a project. One of which is only accessed by the other, not from outside the internet. Is there a feature that allows me to request to that service without exposing both to the internet unnecessarily? Diagram: Client <--> Main Backend API <--> Specific Microservice Thanks again :)
5 replies
RRailway
Created by cheesy_pete on 6/1/2023 in #✋|help
POSTing to a flask app
Hi, I have a very simple flask app:
python
from flask import Flask, jsonify, request
from waitress import serve
import os

app = Flask(__name__)

@app.route('/', methods=['POST', 'GET'])
def index():
print(request)
return jsonify({"Hello from Flask!"})

if __name__ == '__main__':
serve(app, host='0.0.0.0', port=os.getenv("PORT"))
python
from flask import Flask, jsonify, request
from waitress import serve
import os

app = Flask(__name__)

@app.route('/', methods=['POST', 'GET'])
def index():
print(request)
return jsonify({"Hello from Flask!"})

if __name__ == '__main__':
serve(app, host='0.0.0.0', port=os.getenv("PORT"))
When I try to POST to my endpoint in postman I get this in my log:
<Request 'MY_URL'; [GET]>
<Request 'MY_URL'; [GET]>
It is a GET request? This I think has been my problem when I try to run request.get_json() as there is nothing in the body as it is a GET? My question is, how can I fix this to send/receive POST requests properly (it works locally). Thanks :)
11 replies