Responder Web Framework Mini-course Transcripts
Chapter: Consuming the API with Vue.js
Lecture: Calling our RESTful service
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Now before we talk about Vue.js properly at least to quickly introduce the application that I'm going to let you have to play with
0:08
the API that we'll be building here let's just talk about some ways we can call our API. Now, in the beginning, we just clicked on it in PyCharm
0:16
or opened a browser and typed in the address and we just went there. And that's kind of okay for get requests sometimes
0:22
unless you need to modify the header but it's really hard to test post and other types of verbs that way so let me show you something better.
0:29
Let's start by actually just getting our app to run again over here. So this is a fresh copy we're going to work with
0:35
so let's go over here and go to that directory and we're going to create a virtual environment by running Python3 -m venv venv.
0:43
Activate it and upgrade pip 'cause pip is always out of date for virtual environments, it seems like. So with that in place
0:50
we can come over here and open this in PyCharm. All right, super. That's all loaded up. Let's go in here and let's mark this directory.
1:02
That's a sources route and we don't really have to mess with that. That's just HTML and JavaScript, but I guess it won't hurt.
1:09
And mark it as a resource route so it doesn't think things like ../jsfile or whatever are missing. Okay, so, also make sure that we have
1:18
the right thing running. Yes, our virtual environment is there so let's go into MovieDb Service. Install our requirements, so this will run.
1:30
Great, looks like that worked. Let's just go run our app. We might need to change the directory and wait for this to finish, this indexing.
1:38
All right, let's go and run that, see how this works. Click on this. All right, beautiful. It looks like our service is up and running here.
1:45
You've seen this from before. So if we click here, we can test our little run but let's try something besides just calling it a browser.
1:52
Let's go open Postman. You can go and search for Postman in this app. It's really nice, it's free. Come over here and we can enter the URL
2:01
and send it and here we get, you can see a nice output. We can, of course, tweak the body make this a POST or PUT or something like that.
2:09
So if you want to explore and interact with the service and test it a little bit better than with your browser I recommend using Postman for that.
2:17
Of course, it's not an app, it's not as much fun but it is a good way to explore your API as you're building it.