Ex50 URL and function mapping

In Exercise 50 in LP3THW, the notes on Page 259 explain how the code in app.py works. In Step 3 it says there is a mapping between the URL “/” and the function “index”. How does this work? I can’t see a mapping in app.py, and the only function is called “hello_world”. And yet it runs…is there something going on with main, or with this being the only function?

This makes more sense for the same exercise in LP2THW…

Do you see this little piece of code ready for the function definition:


that actually tags the function and says that the function that follows after this line should be given this particular route. You want to research Python decorators. That’s what that little @ symbol is doing