7 lines of code to get a web service

  Write a tomcat or can be deployed on iis web projects, tens of hundreds of lines of code is certainly unavoidable. node.js recent contacts may be able to reduce to a few dozen lines of code.

  However with python, yes that is the number of lines of code python server can be reduced to how much, 7 seven rows you heard right! ! ! We did not talk much on the code.

from flask import Flask

app = Flask(__name__)


@app.route('/')
def hello_world():
    return 'flask 真好!'


if __name__ == '__main__':
    app.run()

  

Guess you like

Origin www.cnblogs.com/AndyLin/p/11541536.html