Method: flask.scaffold.Scaffold.endpoint
Calls: 3, Exceptions: 0, Paths: 1Back
Path 1: 3 calls (1.0)
'bar' (2) 'index' (1)
Scaffold.endpoint.
1@setupmethod
2 def endpoint(self, endpoint: str) -> t.Callable[[F], F]:
3 """Decorate a view function to register it for the given
4 endpoint. Used if a rule is added without a ``view_func`` with
5 :meth:`add_url_rule`.
6
7 .. code-block:: python
8
9 app.add_url_rule("/ex", endpoint="example")
10
11 @app.endpoint("example")
12 def example():
13 ...
14
15 :param endpoint: The endpoint name to associate with the view
16 function.
17 """
18
19 def decorator(f: F) -> F:
20 self.view_functions[endpoint] = f
21 return f
22
23 return decorator