0

How can i get something like this to work?

@app.route('/client_progress')
@app.route('/client_update', methods=['POST', 'GET'])
def func_1():
    if (//app.route == client_progress)
        if request.method == 'POST':
             return 'hello world'

    elif (//app.route == client_update)
        if request.method == 'POST':
             return 'Good World'

I would like to have two app routes to same function and be able to respond back to appropriate route.

is this possible? if yes, please share the example.

PanDe
  • 831
  • 10
  • 21
  • 1
    It's possible but doesn't make sense at all. Why would you group 2 different routes to the same function only to split the logic based on the route inside that same function? why not just have different function for each route to begin with? – DeepSpace Jun 01 '18 at 14:34
  • because i want shareable value, let's say if i create two functions for two app routes and if func_1 is suppose to process a client_name, how would func_2 of other app route identify this information if they don't share resource? In an essence, func_1 process the clients, func_2 displays this client in browser if that makes sense. – PanDe Jun 01 '18 at 14:35
  • There must be a better option for whatever it is that you try to achieve. In order to get better answers you will need to provide a better example. As of now this is an [XY](http://xyproblem.info) problem. – DeepSpace Jun 01 '18 at 14:37

0 Answers0