from flask import Flask, request
app = Flask(__name__)

print(__name__)


@app.route('/')
def index():
    return 'hello world'


@app.route('/<username>/<int:myid>')  # making variable out of url
def profile(username, myid):
    return '<h1>hello %s! your id is: %s and you used %s method.</h1>' % (username, myid, request.method)


# adding post and get method, diffrent responsen depending on method
@app.route('/bacon', methods=['GET', 'POST'])
def bacon():
    if request.method == 'POST':
        return 'using POST'
    else:
        return 'using GET'


if __name__ == "__main__":
    app.run(debug=True, port=9090)
