Hey, did everyone share?
And in this video, I'll talk a little bit on the headers and then I'll walk you through with the documentation
and we'll leave you to explore a bit more on the documentation side.
So so far our application is kind of almost ready and we are handling all of the images and everything
pretty nicely.
Now in addition, what I want to do, I won't be changing it too much, but I just want to have a console
log here.
So I'm going to go ahead and say, Hey, please give me a log here.
And this log will say a request dot header so I can go ahead and see what's all coming in.
Now this I will get all up here so that I can see what is all happening up here in this case.
I'll come back here in a minute.
First, let's go into the swagger and just we don't need to create an entirely separate path.
We can just modify this course, upload a little bit so that we can have this.
I told you, requested body or request.
Body is not the only one you can alongside.
Pass on the parameters.
Let's go ahead and do that that I want to send you some parameters.
Also, the most important part of the parameter is mentioning where the parameters are coming in.
So that's what it takes.
And you define and again, a quick caution, don't use this.
This is not a correct syntax of the YAML, this is the correct syntax.
So in instead of the URL or anything, we are going to say header.
We don't call it URL anyways, but we are going to go and said in the header.
Now further down the road you can go ahead and name this one as simply auth.
Now what this is going to do rather me just saying it, let me just show you that I'm going to go ahead
and hit a reload.
And now notice here you are saying that this is the auth value that can come up into the header.
Let's go ahead and try this one out.
So we're going to say this is a test auth, so we're going to go ahead and send this one.
I would still like to check that.
Are we sending the images?
So I'm going to go ahead and choose my same image.
I'm going to go ahead and open this up and let's go ahead and try to execute this one.
Now, as soon as I execute, this is all good, but I'm looking for is what's coming up into the header.
So notice here this time we are saying the cookie because we have accepted the cookie based authentication
in this.
The value that's coming up is token equals.
This is a secure token.
Not only that, I'm also getting a whole lot of headers that has a lot of good information.
For example, I'm getting this auth, which is purely this one, so you can just provide an authentication
headers and you can just go ahead and accept that into your request, which is being governed by the
Express.
Now, you have a whole lot of information about where this request got origins.
What are the cause, the user agent from where this is coming up, you can even grab IP and a whole
lot of that.
But this is all what we wanted to discuss in this case.
Now, I want to bring your attention a bit on to the documentation, because obviously I can try my
best, but at the end of the day, you will be learning through the documentation after this one.
So look into the authentication and you can see that this is where they get a lot of attention up here.
So they say that this is all the components you can mention in the security schema, whether you are
supporting the beer or basic auth or maybe the cookie based auth.
Now you have to apply the security and you can apply the security of this auth and all of that.
This is how it's being done and this is what I have mentioned up here.
Now, quick notice here, you can also mention that this particular route is governed by the security
measure, which is OAuth or maybe an admin at different kind of a scope that you can pass on scopes.
Definitely is a little bit of doubt because as much as I, I can give to the swagger, I can define
or create an entirety of a course on just the swagger, which can be really big.
But I think we are now at a position that you can come up here, write the basic documentation and learn
on the go as your project gets into the more complex stuff.
I think this is still way more than what you have ever learned in any of the course or tutorial.
This is a more precise and a better guide of doing all the things.
I hope you have enjoyed it.
I hope now you are at a full position of writing a great documentation and make sure you also show me
something that what more you have added in here or how you are actually documentation look like?
By the way, there is also an option that you can add your custom CSS into the swagger and can change
a whole lot of things.
I've seen people doing a whole lot of crazy stuff and absolute amazing one in there.
So this is all what we'll be doing, at least in the swagger section.
Let's go ahead and catch up in the next video.