3 ms·
> Being able to write @@Path("/users") over their listUsers function to have it be called when someone accesses the URL "/users" on the host. That is exactly h
by nickjj 6y ago
> Being able to write @@Path("/users") over their listUsers function to have it be called when someone accesses the URL "/users" on the host.
That is exactly how Flask works by using Python decorators, example:
@app.route('/hello')
def hello_world():
return 'Hello, World!'
That would let you access /hello in a browser. There's also abstractions in place to prefix URL namespaces to a group of functions and add behaviors too (like requiring authentication).
It's nice, especially when the framework comes with an ability to get a dump of all of your routes / URL endpoints in a single command, along with what function it's associated to and the HTTP method. You end up not missing a single routes file that other frameworks have (Rails, Phoenix, etc.).