REST API 1

REST API

[{"id":1,"username":"admin","email":"admin@example.com"},{"id":2,"username":"Vagner","email":"vagner@example.com"},{"id":3,"username":"Administrator","email":"administrador@example.com"}]

Here is what the above code is Doing:
1. We’re importing the Flask class from the flask module.
2. We’re creating an instance of the Flask class. The first argument is the name of the application’s module or package. If you are using a single module (as in this example), you should use __name__ because depending on if it’s started as application or imported as module the name will be different (‘__main__’ versus the actual import name). This is needed so that Flask knows where to look for templates, static files, and so on. For more information have a look at the Flask documentation.
3. We then define our index() route and view function which returns a rendered template.
4. We then define our about() route and view function which returns a rendered template.
5. Finally we call the run() method to run the local server with our application.

Similar Posts