I am a rookie in FLASK. Now I want to use FLASK to put a series of functions into a webservice, which can be called by a third party with Java (there is no need to write the interface for the time being, only a function interface is needed). Recently, I have seen some things about FLASK, but I still have a lot of questions. Take the following small project as an example:
create a new FLASK project using VS2015, and write the function I need to encapsulate in the views.py file. The function is to pass a name of string type and return "hello name":
"""
Routes and views for the flask application.
"""
from datetime import datetime
from flask import render_template
from flask import Flask
from FlaskWebProject1 import app
app = Flask(__name__)
@app.route("/")
@app.route("/greeting",methods = ["GET"])
def greeting(name):
return ("hello"+name)
if __name__ == "__main__":
app.run(debug=True)
if I want to encapsulate this greeting () function, should it be written as above? What else do I need to do in order for the webservice containing this function to be called by a third party using Java? How to judge the success of the webservice? Thank you for your attention.