May 2018
Intermediate to advanced
554 pages
13h 51m
English
Build WebUI that uses preceding microservice by following steps:
$ cat entry.pyimport osimport httplibfrom flask import Flask, request, render_templateapp = Flask(__name__)@app.route("/")def index(): return render_template('index.html')@app.route("/add", methods=['POST'])def add(): # # from POST parameters # x = int(request.form['x']) y = int(request.form['y']) # # from Kubernetes Service(environment variables) # my_calc_host = os.environ['MY_CALC_SERVICE_SERVICE_HOST'] my_calc_port = os.environ['MY_CALC_SERVICE_SERVICE_PORT'] # # REST call to MicroService(my-calc) # client = httplib.HTTPConnection(my_calc_host, my_calc_port) client.request("GET", "/addition/%d/%d" ...Read now
Unlock full access