Skip to content

Instantly share code, notes, and snippets.

@anandtripathi5
Last active April 1, 2022 11:20
Show Gist options
  • Save anandtripathi5/2f9197689cbad767e1589a3eaf5098ca to your computer and use it in GitHub Desktop.
Save anandtripathi5/2f9197689cbad767e1589a3eaf5098ca to your computer and use it in GitHub Desktop.
This is a minimal example of Flask 2.0
from flask import Flask
app = Flask('__name__')
@app.get('/hello')
@app.post('/hello')
def hello():
return 'This is the awesome hello api request'
@app.get('/world')
@app.post('/world')
def world():
return 'This is the awesome world api request'
@app.get('/square/<int:number>')
def square(number):
return f'Square of given number is {number * number}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment