Eve: Building RESTful APIs with MongoDB and Flask Transcripts
Chapter: Fine-tuning your REST service
Lecture: Still a Flask app
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We saw how many features the Eve framework brings to the table
0:03
and one very important feature you should never forget about is
0:08
that Eve still is a 100% Flask application.
0:12
Let me illustrate, if you remember when we were doing
0:15
the Flask hello world app a few lectures ago,
0:20
all we had to do was define a function
0:23
return something, a string, for example,
0:32
and then decorate our function with a route decorator,
0:38
and we need to pass the URL.
0:41
So pure Flask RestFul dispatching at work here.
0:46
But we're using an app instance of Eve class not Flask class
0:50
but because Eve is actually a subclass of Flask
0:53
this is going to work, let's try and save,
0:57
server restarts, we go to Postman and we hit the local host 5000 hello endpoint.
1:08
Boom, hello world, and we're still getting all the features coming from Eve,
1:16
right now we don't have authentication going here
1:19
but we only need to edit and here we go,
1:26
and by the way, we're using Postman here
1:28
but we could as well go back to our browser access
1:36
our endpoint, as we used to do with the basic Flask application.
1:40
Of course, if we go and hit the people endpoint from the browser,
1:44
it works, but we need to authenticate,
1:54
I don't remember the password, it was a secret, right,
1:58
yes, here it is, well, hardly readable,
2:00
but rest assured, this is the same output we're getting from Postman.
2:03
So full Flask power plus Eve features at your fingertips.