├── 9. Review and Add Changes to GitHub.srt ├── 4. Review and Add Changes to GitHub.srt ├── 5. Final Touches and Add Changes to GitHub.srt ├── 4. IMPORTANT - User Registration Endpoint Fix.srt ├── 1. Section Overview.srt ├── .gitattributes ├── 2. Setup GitHub Account.srt ├── 7. Review and Add Changes to GitHub.srt ├── 1. Introduction.srt ├── 5. Review and Add Changes to GitHub.srt ├── 4. Setup GET Endpoints For Hotels.srt ├── 1. Overview.srt ├── 6. Explore JSON Web Tokens (JWT).srt ├── .gitignore ├── 4. CORS Configuration.srt ├── 1. Configure Hosting Environment.srt ├── 3. Construct DELETE Endpoint.srt ├── 2. Seed Data In Tables.srt ├── 6. Rate Limiting and Throttling.srt ├── 1. Install Visual Studio 2019 Community Edition and .Net 5 SDK.srt ├── 1. Create Microsoft Azure Account.srt ├── 1. Create and Tour Web API Project.srt ├── 8. Protecting Endpoints.srt ├── 3. Construct GET By Id Endpoint.srt ├── 3. Explore Swagger UI.srt ├── 5. Add User Roles.srt └── 3. Install and Explore PostMan.srt /9. Review and Add Changes to GitHub.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,500 --> 00:00:01,470 3 | Welcome back, guys. 4 | 5 | 2 6 | 00:00:01,520 --> 00:00:05,720 7 | Well, it's another significant check point, and every time we get a significant check points, we 8 | 9 | 3 10 | 00:00:05,720 --> 00:00:13,160 11 | go ahead and check in our code so you can just go ahead and write your check in message and then commit 12 | 13 | 4 14 | 00:00:13,160 --> 00:00:14,710 15 | all and sync. 16 | 17 | 5 18 | 00:00:15,080 --> 00:00:20,740 19 | And once that is completed, then we will move on to our next exciting activity. 20 | -------------------------------------------------------------------------------- /4. Review and Add Changes to GitHub.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,470 --> 00:00:06,770 3 | Our guys, so we're once again at another milestone, what we're going to do is check in over changes. 4 | 5 | 2 6 | 00:00:06,770 --> 00:00:16,160 7 | So we added all the missing endpoints for the post, the puts and the delete requests for both hotels 8 | 9 | 3 10 | 00:00:16,160 --> 00:00:17,090 11 | and countries. 12 | 13 | 4 14 | 00:00:17,360 --> 00:00:23,780 15 | And the concepts that you've learned along the way can be applied as well as many times as you need 16 | 17 | 5 18 | 00:00:23,780 --> 00:00:26,220 19 | them to, as many endpoints as you need to facilitate. 20 | 21 | 6 22 | 00:00:26,240 --> 00:00:28,040 23 | You can apply them also. 24 | 25 | 7 26 | 00:00:28,520 --> 00:00:33,860 27 | So we just go ahead and go to get changes at our message. 28 | 29 | 8 30 | 00:00:33,870 --> 00:00:38,090 31 | And then what I'm going to do is just commit all and sync. 32 | 33 | 9 34 | 00:00:38,360 --> 00:00:43,430 35 | And once that is completed, then you can stick around for the next adventure. 36 | -------------------------------------------------------------------------------- /5. Final Touches and Add Changes to GitHub.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,560 --> 00:00:06,630 3 | All right, guys, so we're back in our project and our task today is simple, we're just sworn to take 4 | 5 | 2 6 | 00:00:06,630 --> 00:00:07,950 7 | in all our changes. 8 | 9 | 3 10 | 00:00:07,950 --> 00:00:12,930 11 | So anything with our Atik would have been modified along the way once again and anything with a green 12 | 13 | 4 14 | 00:00:12,930 --> 00:00:14,190 15 | plus sign was added. 16 | 17 | 5 18 | 00:00:14,190 --> 00:00:17,150 19 | So we can just go ahead and go to get changes. 20 | 21 | 6 22 | 00:00:17,730 --> 00:00:22,830 23 | And I'm just going to refresh what I don't need to refresh here all my changes listed. 24 | 25 | 7 26 | 00:00:23,010 --> 00:00:25,140 27 | So I'm going to put in my message. 28 | 29 | 8 30 | 00:00:25,290 --> 00:00:30,600 31 | And my message is just letting everybody know that I did the country and the hotel get my thoughts. 32 | 33 | 9 34 | 00:00:30,600 --> 00:00:36,450 35 | Also fix the units of work by short for dependency injection reference, because remember, we made 36 | 37 | 10 38 | 00:00:36,450 --> 00:00:41,340 39 | that modification in the start so I can go ahead and commit and sync. 40 | 41 | 11 42 | 00:00:43,750 --> 00:00:47,830 43 | And once that is done, we're ready to move on to our next module. 44 | -------------------------------------------------------------------------------- /4. IMPORTANT - User Registration Endpoint Fix.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,770 --> 00:00:06,350 3 | Hey, guys, one quick addendum to what was done in the previous activity, setting up the registration 4 | 5 | 2 6 | 00:00:06,350 --> 00:00:08,060 7 | endpoints and everything, it worked. 8 | 9 | 3 10 | 00:00:08,410 --> 00:00:14,840 11 | However, when I checked the data, I realized that my user did not have a password, and that's because 12 | 13 | 4 14 | 00:00:14,840 --> 00:00:17,360 15 | I did not put this part on. 16 | 17 | 5 18 | 00:00:17,370 --> 00:00:20,390 19 | So if you look at the create user function. 20 | 21 | 6 22 | 00:00:21,560 --> 00:00:27,530 23 | It has to overtones, one where it just creates the user and another one where it asks you for the user 24 | 25 | 7 26 | 00:00:27,530 --> 00:00:29,110 27 | and the password to go with them. 28 | 29 | 8 30 | 00:00:29,120 --> 00:00:35,930 31 | So I'm not entirely sure why they feel the need to me to because for me, a user has to have a password. 32 | 33 | 9 34 | 00:00:35,930 --> 00:00:40,360 35 | But I guess for different situations, they may need to store something on the other. 36 | 37 | 10 38 | 00:00:40,410 --> 00:00:48,680 39 | So user karma and then from the user need to go to the password so that we can ensure that when the 40 | 41 | 11 42 | 00:00:48,680 --> 00:00:55,160 43 | user manager creates that user, that password is also going to get touched and stored on their record. 44 | -------------------------------------------------------------------------------- /1. Section Overview.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,630 --> 00:00:07,350 3 | It goes so we'll be starting a new section of our API development and really actually this is just about 4 | 5 | 2 6 | 00:00:07,350 --> 00:00:08,600 7 | value added features. 8 | 9 | 3 10 | 00:00:08,610 --> 00:00:10,290 11 | We've done quite a bit of work. 12 | 13 | 4 14 | 00:00:10,530 --> 00:00:16,800 15 | We already have a functioning API with a nice, clean architecture that can be easily extended. 16 | 17 | 5 18 | 00:00:17,070 --> 00:00:21,810 19 | However, there are certain things that we want to take advantage of when it comes to core. 20 | 21 | 6 22 | 00:00:22,110 --> 00:00:30,060 23 | And these features are these allowances will enable us to reduce some of the repeated code that we have 24 | 25 | 7 26 | 00:00:30,060 --> 00:00:31,440 27 | throughout our application. 28 | 29 | 8 30 | 00:00:31,830 --> 00:00:37,430 31 | So let's say, for instance, one we keep on repeating track catch. 32 | 33 | 9 34 | 00:00:37,440 --> 00:00:39,760 35 | Every time we do an operation, we have the track. 36 | 37 | 10 38 | 00:00:39,920 --> 00:00:46,290 39 | So we'll be looking at putting in code to reduce that and handle errors in a global fashion. 40 | 41 | 11 42 | 00:00:46,290 --> 00:00:52,590 43 | Since we really do the same thing almost every time, all the things we'll be looking at will be to 44 | 45 | 12 46 | 00:00:52,590 --> 00:01:00,150 47 | reduce our need for checking certain doing certain checks before we complete certain operations or putting 48 | 49 | 13 50 | 00:01:00,150 --> 00:01:01,290 51 | in action filters. 52 | 53 | 14 54 | 00:01:01,530 --> 00:01:08,910 55 | We'll also be putting in mechanisms to help speed up the retrieval and processing of data like caching 56 | 57 | 15 58 | 00:01:08,910 --> 00:01:09,660 59 | paging. 60 | 61 | 16 62 | 00:01:09,810 --> 00:01:15,320 63 | So we'll be looking at all of these things and we'll start off with implementing paging. 64 | 65 | 17 66 | 00:01:15,330 --> 00:01:16,050 67 | So stay tuned. 68 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /2. Setup GitHub Account.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:01,920 --> 00:00:08,140 3 | Hey, guys, in this video will be creating or GitHub Balcones, and this is a really simplistic getup, 4 | 5 | 2 6 | 00:00:08,160 --> 00:00:10,060 7 | makes it very easy for us to sign up. 8 | 9 | 3 10 | 00:00:10,320 --> 00:00:12,210 11 | You just need to go to get tubed up. 12 | 13 | 4 14 | 00:00:12,210 --> 00:00:21,840 15 | Come, that's g i t to B dot seal and get tubed up and you will land on this bridge from here. 16 | 17 | 5 18 | 00:00:21,840 --> 00:00:26,400 19 | If you already have an account then you can sign in and you can pretty much stop watching the video 20 | 21 | 6 22 | 00:00:26,400 --> 00:00:26,730 23 | here. 24 | 25 | 7 26 | 00:00:26,940 --> 00:00:30,450 27 | If you don't however, then the Senate form is right here. 28 | 29 | 8 30 | 00:00:30,450 --> 00:00:34,230 31 | You can do a little reading just to get an appreciation of what GitHub is for. 32 | 33 | 9 34 | 00:00:34,230 --> 00:00:41,280 35 | And it's all about they do have pricing, so they do offer enterprise plans and education plans and 36 | 37 | 10 38 | 00:00:41,280 --> 00:00:42,930 39 | different plans for different situations. 40 | 41 | 11 42 | 00:00:42,930 --> 00:00:50,010 43 | But for the solar developer or for very small teams, that may not be enterprise level, then they do 44 | 45 | 12 46 | 00:00:50,610 --> 00:00:52,410 47 | give you a lot for free. 48 | 49 | 13 50 | 00:00:52,770 --> 00:01:00,120 51 | So to sign up, you need only put in a user name and an email address and a password. 52 | 53 | 14 54 | 00:01:00,270 --> 00:01:05,400 55 | And once you have provided all those things and provided that your user name is unique and of course, 56 | 57 | 15 58 | 00:01:05,580 --> 00:01:09,010 59 | then you sign up for GitHub and you should be in. 60 | 61 | 16 62 | 00:01:09,060 --> 00:01:11,970 63 | So I already have an account, so I'm really just going to sign in. 64 | 65 | 17 66 | 00:01:12,150 --> 00:01:17,700 67 | You saw my brothers are going crazy trying to provide information, so I'm just going to sign in with 68 | 69 | 18 70 | 00:01:17,820 --> 00:01:19,260 71 | my existing account. 72 | 73 | 19 74 | 00:01:19,530 --> 00:01:21,690 75 | So that's my what? 76 | 77 | 20 78 | 00:01:21,700 --> 00:01:25,560 79 | You can use your username or email address to sign in and the password. 80 | 81 | 21 82 | 00:01:26,790 --> 00:01:27,900 83 | And here I am. 84 | 85 | 22 86 | 00:01:27,900 --> 00:01:29,040 87 | This is my landing page. 88 | 89 | 23 90 | 00:01:29,040 --> 00:01:32,640 91 | So they actually give you like a sense of community. 92 | 93 | 24 94 | 00:01:32,640 --> 00:01:34,590 95 | It's almost like a Facebook for developers. 96 | 97 | 25 98 | 00:01:34,590 --> 00:01:40,710 99 | To some extent you can follow people and once they're following people, you see their activities on 100 | 101 | 26 102 | 00:01:40,710 --> 00:01:43,590 103 | the landing page, you can jump to your repository. 104 | 105 | 27 106 | 00:01:43,590 --> 00:01:48,090 107 | So obviously, if you're new to GitHub, then you wouldn't have anything listed to the site here. 108 | 109 | 28 110 | 00:01:48,090 --> 00:01:53,940 111 | But I'm not new, so I've been quite busy putting content on GitHub. 112 | 113 | 29 114 | 00:01:53,940 --> 00:01:55,410 115 | Almost any little pet project. 116 | 117 | 30 118 | 00:01:55,410 --> 00:01:56,280 119 | That's a start. 120 | 121 | 31 122 | 00:01:56,400 --> 00:01:58,280 123 | I have a GitHub repository, actually. 124 | 125 | 32 126 | 00:01:58,290 --> 00:02:00,060 127 | I need to go through and clean this up. 128 | 129 | 33 130 | 00:02:00,300 --> 00:02:07,320 131 | And also I've had students add me to their reports in the past so that we could collaborate. 132 | 133 | 34 134 | 00:02:07,320 --> 00:02:12,090 135 | Maybe they were having a problem and I could just verify their code through the repository. 136 | 137 | 35 138 | 00:02:12,300 --> 00:02:17,160 139 | All of those things are, you know, possible through this very powerful tool. 140 | 141 | 36 142 | 00:02:17,430 --> 00:02:22,860 143 | But once you have created your account and you're signed in and, well, you obviously wouldn't see 144 | 145 | 37 146 | 00:02:22,860 --> 00:02:28,110 147 | what I'm seeing once again, but then that would complete the sign of active. 148 | -------------------------------------------------------------------------------- /7. Review and Add Changes to GitHub.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,390 --> 00:00:05,490 3 | All right, guys, so that's another milestone where we're just going to review the things that we implemented 4 | 5 | 2 6 | 00:00:05,490 --> 00:00:08,330 7 | in this section and then get to our changes to GitHub. 8 | 9 | 3 10 | 00:00:08,760 --> 00:00:12,690 11 | So going in order of what we did, the first one would be paging. 12 | 13 | 4 14 | 00:00:12,710 --> 00:00:20,300 15 | So we implemented paging where we post in some were request parameters into our get countries. 16 | 17 | 5 18 | 00:00:20,310 --> 00:00:23,880 19 | And we also went in and said some defaults to see if they don't provide any. 20 | 21 | 6 22 | 00:00:23,910 --> 00:00:27,180 23 | Then we're going to provide this much information upfront. 24 | 25 | 7 26 | 00:00:27,180 --> 00:00:33,870 27 | Otherwise we give the client the opportunity to say they want this many records. 28 | 29 | 8 30 | 00:00:33,870 --> 00:00:40,380 31 | Starting from this point on, they're represented by the number as well as the page. 32 | 33 | 9 34 | 00:00:40,380 --> 00:00:40,670 35 | Right. 36 | 37 | 10 38 | 00:00:41,250 --> 00:00:43,440 39 | So that's one thing that we implemented. 40 | 41 | 11 42 | 00:00:43,440 --> 00:00:49,590 43 | We also implemented global era handling, which allows us to create or write to our code without the 44 | 45 | 12 46 | 00:00:49,590 --> 00:00:51,780 47 | need for too many track catches. 48 | 49 | 13 50 | 00:00:51,780 --> 00:00:57,540 51 | And it comes a little bit neater than it was before, where every time we're seeing track catch track. 52 | 53 | 14 54 | 00:00:58,080 --> 00:00:58,360 55 | All right. 56 | 57 | 15 58 | 00:00:59,400 --> 00:01:04,170 59 | Another thing that we did was implement versioning on our API. 60 | 61 | 16 62 | 00:01:04,170 --> 00:01:13,110 63 | So we created this Contrave to controller just for experiment purposes where we specify the API version 64 | 65 | 17 66 | 00:01:13,110 --> 00:01:18,620 67 | and we explored how we can allow the client to specify which version of the API it is that they want. 68 | 69 | 18 70 | 00:01:18,960 --> 00:01:27,140 71 | And I think the last bit of configuration would have them positive as better. 72 | 73 | 19 74 | 00:01:27,810 --> 00:01:28,410 75 | All right. 76 | 77 | 20 78 | 00:01:28,540 --> 00:01:34,440 79 | So in our extend services we put in still for the exception, handling the global exception, handling 80 | 81 | 21 82 | 00:01:34,770 --> 00:01:39,360 83 | to see, you know, and there's an error log and return with that. 84 | 85 | 22 86 | 00:01:39,360 --> 00:01:42,040 87 | Five hundred for the versioning. 88 | 89 | 23 90 | 00:01:42,270 --> 00:01:49,800 91 | We did say that we want to implement versioning reading from the header being passed in with the request. 92 | 93 | 24 94 | 00:01:50,100 --> 00:01:53,850 95 | We specify the default API version to be one point or so. 96 | 97 | 25 98 | 00:01:53,850 --> 00:01:56,700 99 | If money is specified, then it's 1.0. 100 | 101 | 26 102 | 00:01:57,030 --> 00:02:05,580 103 | We also looked at implementing caching so we can actually just provide data for up to a certain amount 104 | 105 | 27 106 | 00:02:05,580 --> 00:02:09,090 107 | of time before we have to pull the database for the next request. 108 | 109 | 28 110 | 00:02:09,450 --> 00:02:15,300 111 | And we also put in validation to make sure that once the underlying data changes that need to kind of 112 | 113 | 29 114 | 00:02:15,300 --> 00:02:17,670 115 | refresh is on top in the cash layer. 116 | 117 | 30 118 | 00:02:18,240 --> 00:02:25,890 119 | And last, but by no means least, we put in throttling to kind of control how often a particular client 120 | 121 | 31 122 | 00:02:25,890 --> 00:02:32,430 123 | based on IP address, at least based on the way we've configured it, can hit a particular endpoint. 124 | 125 | 32 126 | 00:02:32,460 --> 00:02:38,670 127 | So right now the limit is very small, the period is small, but that's just for our experiment purpose. 128 | 129 | 33 130 | 00:02:38,670 --> 00:02:44,460 131 | In our real situation, probably you can look at other providers like Google and so on, and if your 132 | 133 | 34 134 | 00:02:44,460 --> 00:02:52,320 135 | infrastructure is robust enough, you can use their their values to inform you as to how you can put 136 | 137 | 35 138 | 00:02:52,320 --> 00:02:54,260 139 | in throttling what I leave those examples. 140 | 141 | 36 142 | 00:02:54,260 --> 00:03:00,480 143 | What is there for now and what we want to do is check in so we know that we just go over to get changes 144 | 145 | 37 146 | 00:03:00,810 --> 00:03:04,320 147 | and then we put in our message and that is my message. 148 | 149 | 38 150 | 00:03:04,330 --> 00:03:09,270 151 | So when I do this check in, I'll just go ahead and commit and sync. 152 | 153 | 39 154 | 00:03:09,270 --> 00:03:14,640 155 | So everything that I've done here and remember that in the examples of it, I've done it in one place. 156 | 157 | 40 158 | 00:03:14,640 --> 00:03:16,470 159 | I'd encourage you to try it in the other place. 160 | 161 | 41 162 | 00:03:16,470 --> 00:03:19,980 163 | But then you can always check the source code and double check and compare notes. 164 | 165 | 42 166 | 00:03:20,610 --> 00:03:24,200 167 | And once all of that is done, we're ready to move on to our next topic. 168 | -------------------------------------------------------------------------------- /1. Introduction.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,120 --> 00:00:06,090 3 | Hey, guys, I want to take this time out to welcome you to this new course, ultimate SB at five Web 4 | 5 | 2 6 | 00:00:06,090 --> 00:00:08,440 7 | API Development Guide No. 8 | 9 | 3 10 | 00:00:08,550 --> 00:00:13,200 11 | Its title is a mouthful, but I can assure you the contents sort of lives up to the billing. 12 | 13 | 4 14 | 00:00:13,560 --> 00:00:18,870 15 | In this course, you'll learn how to create and maintain maintainable Web API using air speed net five, 16 | 17 | 5 18 | 00:00:18,870 --> 00:00:24,210 19 | which is the latest and greatest in the Microsoft Development Stock Entity framework. 20 | 21 | 6 22 | 00:00:24,420 --> 00:00:30,300 23 | And we will explore many enterprise level design patterns and considerations when it comes to designing 24 | 25 | 7 26 | 00:00:30,300 --> 00:00:31,020 27 | an API. 28 | 29 | 8 30 | 00:00:31,830 --> 00:00:33,570 31 | I am your instructor for this course. 32 | 33 | 9 34 | 00:00:33,600 --> 00:00:38,160 35 | My name is Trevor Williams, I am a software engineer and part time lectures. 36 | 37 | 10 38 | 00:00:39,430 --> 00:00:46,630 39 | Now, let's explore what's an API is the letters app and I are short for application programming interface, 40 | 41 | 11 42 | 00:00:46,990 --> 00:00:52,390 43 | pretty much an API is a software interface that acts as an intermediary between two applications. 44 | 45 | 12 46 | 00:00:52,690 --> 00:01:00,000 47 | So let's say you can access Facebook like functionalities from an app that is not a Facebook app. 48 | 49 | 13 50 | 00:01:00,250 --> 00:01:07,180 51 | So this app has to talk to Facebook and allow you to do Facebook like things, whether that is communicating 52 | 53 | 14 54 | 00:01:07,180 --> 00:01:08,960 55 | with Facebook through an API. 56 | 57 | 15 58 | 00:01:09,190 --> 00:01:14,770 59 | So in this course, you will learn how to build that kind of interface to allow persons to access an 60 | 61 | 16 62 | 00:01:14,770 --> 00:01:20,770 63 | underlying data store that we will be building using functionality that we will be building or using 64 | 65 | 17 66 | 00:01:20,770 --> 00:01:27,480 67 | clients that they will need to build, whether it's from mobile or web or any other type of device. 68 | 69 | 18 70 | 00:01:27,610 --> 00:01:34,360 71 | So APIs or at least the type of API that we will be building are based on the rest principles. 72 | 73 | 19 74 | 00:01:34,360 --> 00:01:40,290 75 | So we will learn, rest and rest assured for representational state transfer. 76 | 77 | 20 78 | 00:01:40,330 --> 00:01:45,820 79 | It is a very popular Web API standard and it is across many platforms. 80 | 81 | 21 82 | 00:01:45,820 --> 00:01:53,500 83 | So though we will be building the API using the net or the API can be consumed by clients from many 84 | 85 | 22 86 | 00:01:53,500 --> 00:01:54,600 87 | other developments. 88 | 89 | 23 90 | 00:01:54,610 --> 00:01:58,000 91 | That's in addition to this will be learning how to use that. 92 | 93 | 24 94 | 00:01:58,000 --> 00:02:05,290 95 | Natcore five will be looking at how to understand the services and how the whole application still works. 96 | 97 | 25 98 | 00:02:05,590 --> 00:02:10,360 99 | And we'll also be looking at using enterprise level pattern. 100 | 101 | 26 102 | 00:02:10,370 --> 00:02:15,700 103 | So, you know, best practices that we can put into the code such that when we are ready to expand, 104 | 105 | 27 106 | 00:02:15,700 --> 00:02:22,180 107 | whether through our own self discovery or in an enterprise setting, we won't have to pull up too much 108 | 109 | 28 110 | 00:02:22,180 --> 00:02:24,010 111 | of our application to do that. 112 | 113 | 29 114 | 00:02:24,190 --> 00:02:26,720 115 | But we can just take on components as we go along. 116 | 117 | 30 118 | 00:02:27,220 --> 00:02:32,590 119 | So in a nutshell, you're going to learn Espie dominated by an entity framework for we're going to be 120 | 121 | 31 122 | 00:02:32,590 --> 00:02:39,280 123 | using code first database development and exploring once again key encoding patterns, looking at API 124 | 125 | 32 126 | 00:02:39,280 --> 00:02:46,060 127 | authentication, using JSON Web tokens or JWT for short, how we can protect and harden our endpoints 128 | 129 | 33 130 | 00:02:46,060 --> 00:02:50,260 131 | and protect them from unauthorized or unwanted access. 132 | 133 | 34 134 | 00:02:50,560 --> 00:02:58,210 135 | We look at understanding the darknet poor service pipeline and how we can extend them and put in our 136 | 137 | 35 138 | 00:02:58,240 --> 00:02:59,170 139 | own middleware. 140 | 141 | 36 142 | 00:02:59,410 --> 00:03:07,090 143 | We're looking at API testing and logging, so we'll be using Horstmann and Cerillo for our API testing 144 | 145 | 37 146 | 00:03:07,090 --> 00:03:09,100 147 | and logging purposes respectfully. 148 | 149 | 38 150 | 00:03:09,280 --> 00:03:15,220 151 | And we'll also be looking at how Swiger can play a part in documenting our API and also helping with 152 | 153 | 39 154 | 00:03:15,220 --> 00:03:17,110 155 | our testing source control. 156 | 157 | 40 158 | 00:03:17,110 --> 00:03:22,750 159 | We will be using GitHub so that we can securely store our code and be able to roll back should we need 160 | 161 | 41 162 | 00:03:22,750 --> 00:03:23,020 163 | to. 164 | 165 | 42 166 | 00:03:23,170 --> 00:03:30,100 167 | And then we look at after building all of these wonderful things, how exactly we allow our API to be 168 | 169 | 43 170 | 00:03:30,130 --> 00:03:37,580 171 | accessed, whether in a company setting or by the world know this course has quite a bitterness. 172 | 173 | 44 174 | 00:03:37,600 --> 00:03:42,430 175 | It's about 10 hours long and you will be learning a lot of things. 176 | 177 | 45 178 | 00:03:42,440 --> 00:03:45,280 179 | So buckle up, get ready for this journey. 180 | 181 | 46 182 | 00:03:45,280 --> 00:03:47,400 183 | And I'm very excited to have you along. 184 | -------------------------------------------------------------------------------- /5. Review and Add Changes to GitHub.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,890 --> 00:00:02,000 3 | Hey, guys, welcome back. 4 | 5 | 2 6 | 00:00:02,030 --> 00:00:05,760 7 | So we're at the second check in check point for our project. 8 | 9 | 3 10 | 00:00:05,780 --> 00:00:11,960 11 | So after each module, we'll just review what we've done and then go ahead and update our repository 12 | 13 | 4 14 | 00:00:11,960 --> 00:00:12,550 15 | accordingly. 16 | 17 | 5 18 | 00:00:12,560 --> 00:00:18,710 19 | So it's always good to keep the Collins off your, you know, small wins so that if your code gets corrected 20 | 21 | 6 22 | 00:00:18,710 --> 00:00:24,860 23 | later on, you can always revert to the most recent working version of your application. 24 | 25 | 7 26 | 00:00:25,430 --> 00:00:34,340 27 | So firstly, we can always know the changes that have been made by looking at the files already means 28 | 29 | 8 30 | 00:00:34,340 --> 00:00:34,910 31 | it was there. 32 | 33 | 9 34 | 00:00:34,910 --> 00:00:38,030 35 | And it is no different from the last thing that was checked in. 36 | 37 | 10 38 | 00:00:38,240 --> 00:00:41,760 39 | And the processing means that it has been added since the last chicken. 40 | 41 | 11 42 | 00:00:41,780 --> 00:00:48,890 43 | So it is always keeping track of what the file looked like and letting you know that it's no different 44 | 45 | 12 46 | 00:00:49,100 --> 00:00:54,280 47 | through old or ADIC or letting you know that this has been added since the last time. 48 | 49 | 13 50 | 00:00:54,920 --> 00:01:00,820 51 | If you want to see what has changed, you can actually right click go to it and you can see if history 52 | 53 | 14 54 | 00:01:00,830 --> 00:01:01,690 55 | or compare. 56 | 57 | 15 58 | 00:01:01,700 --> 00:01:09,560 59 | So when you do compare it to say, well, the last version I had is to the left, I'm just getting my 60 | 61 | 16 62 | 00:01:09,560 --> 00:01:10,220 63 | bearings right. 64 | 65 | 17 66 | 00:01:10,220 --> 00:01:14,590 67 | So the version I had is to the left and the new version is to the right. 68 | 69 | 18 70 | 00:01:14,600 --> 00:01:18,280 71 | So literally that this line was modified in that way. 72 | 73 | 19 74 | 00:01:18,590 --> 00:01:22,360 75 | And everywhere you see a green highlighted, it means that something happened. 76 | 77 | 20 78 | 00:01:22,610 --> 00:01:28,040 79 | So when working in a team setting, though, it's always recommended that you guys don't work on the 80 | 81 | 21 82 | 00:01:28,040 --> 00:01:34,670 83 | same files to check in, because then if you modify something on your side and modify that same file 84 | 85 | 22 86 | 00:01:34,670 --> 00:01:41,180 87 | on my side, then we end up with this clashing kind of like this crushing situation where we'll say, 88 | 89 | 23 90 | 00:01:41,180 --> 00:01:44,180 91 | well, the two lines are seeing two entirely different things. 92 | 93 | 24 94 | 00:01:44,180 --> 00:01:46,250 95 | Which one should I use at that point? 96 | 97 | 25 98 | 00:01:46,250 --> 00:01:48,710 99 | You have to manage what you call conflicts. 100 | 101 | 26 102 | 00:01:48,860 --> 00:01:51,890 103 | I'm coding by myself, so I can't really see any conflicts right now. 104 | 105 | 27 106 | 00:01:52,460 --> 00:01:55,890 107 | But hopefully you guys don't encounter that. 108 | 109 | 28 110 | 00:01:56,660 --> 00:01:59,720 111 | So what we're going to do is check in. 112 | 113 | 29 114 | 00:01:59,720 --> 00:02:01,850 115 | So to do that, I can right. 116 | 117 | 30 118 | 00:02:01,850 --> 00:02:03,650 119 | Click go to get. 120 | 121 | 31 122 | 00:02:03,650 --> 00:02:06,290 123 | No, that is incorrect to get changes. 124 | 125 | 32 126 | 00:02:06,590 --> 00:02:07,210 127 | There we go. 128 | 129 | 33 130 | 00:02:07,220 --> 00:02:12,470 131 | So new version of Visual Studio is a different level to just go with the get changes once again. 132 | 133 | 34 134 | 00:02:12,470 --> 00:02:18,410 135 | If you're not seeing that, you can always click view and you will be able to see that menu item accordingly. 136 | 137 | 35 138 | 00:02:18,770 --> 00:02:22,160 139 | So you always want to put in a message that depicts what was. 140 | 141 | 36 142 | 00:02:22,670 --> 00:02:29,850 143 | So my message is the mean telling whoever would see the second at a database of some upper unit for 144 | 145 | 37 146 | 00:02:29,900 --> 00:02:33,140 147 | I need you so you don't need to be you don't need to write an essay. 148 | 149 | 38 150 | 00:02:33,470 --> 00:02:38,000 151 | But at least let me have an idea or however have an idea of what you've done. 152 | 153 | 39 154 | 00:02:38,330 --> 00:02:40,100 155 | After that, we can click that. 156 | 157 | 40 158 | 00:02:40,100 --> 00:02:40,760 159 | Correct. 160 | 161 | 41 162 | 00:02:41,030 --> 00:02:43,970 163 | And then we see it all on the scene. 164 | 165 | 42 166 | 00:02:43,970 --> 00:02:51,020 167 | So it will commit the changes one and two to see if just wait and see if you will commit the changes 168 | 169 | 43 170 | 00:02:51,020 --> 00:02:54,770 171 | locally and then it will kind of synchronize with GitHub. 172 | 173 | 44 174 | 00:02:55,130 --> 00:03:00,800 175 | And at that point, if there are changes waiting on the other side, meaning your team member made some 176 | 177 | 45 178 | 00:03:00,800 --> 00:03:03,890 179 | changes and check them in before. 180 | 181 | 46 182 | 00:03:04,220 --> 00:03:08,900 183 | When you say come, it's all and think it will push up your changes, get the latest ones. 184 | 185 | 47 186 | 00:03:08,900 --> 00:03:14,900 187 | And once again, if you do modify the same file with different content, that's where that conflict 188 | 189 | 48 190 | 00:03:15,050 --> 00:03:16,100 191 | might come up. 192 | 193 | 49 194 | 00:03:16,100 --> 00:03:19,760 195 | So if you don't do that, then this is a really seamless process. 196 | 197 | 50 198 | 00:03:20,000 --> 00:03:26,660 199 | So here, we'll let you know that it was successfully synchronized and you can move along to the next 200 | 201 | 51 202 | 00:03:26,810 --> 00:03:27,410 203 | task. 204 | -------------------------------------------------------------------------------- /4. Setup GET Endpoints For Hotels.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,860 --> 00:00:04,990 3 | All right, guys, so I'm issuing a challenge to you, I want you to pause the video. 4 | 5 | 2 6 | 00:00:05,000 --> 00:00:07,430 7 | Yes, it just started, but go ahead and pause it. 8 | 9 | 3 10 | 00:00:08,000 --> 00:00:15,200 11 | And I want you to go ahead and create a controller for the hotels you can call a total controller and 12 | 13 | 4 14 | 00:00:15,410 --> 00:00:19,730 15 | the functionality that we have just gone through with our country controller. 16 | 17 | 5 18 | 00:00:19,760 --> 00:00:23,720 19 | I want you to replicate it in the context of the hotels. 20 | 21 | 6 22 | 00:00:24,020 --> 00:00:25,400 23 | So I already have it here. 24 | 25 | 7 26 | 00:00:26,180 --> 00:00:27,620 27 | But I want you to pause. 28 | 29 | 8 30 | 00:00:27,620 --> 00:00:29,030 31 | We're going to go through it together. 32 | 33 | 9 34 | 00:00:29,030 --> 00:00:34,550 35 | But I want you to pause activity to yourself and then we compare notes. 36 | 37 | 10 38 | 00:00:35,820 --> 00:00:41,370 39 | All right, so I'm back and I'm saying I'm back because I'm assuming that you pause the video, I know 40 | 41 | 11 42 | 00:00:41,370 --> 00:00:42,130 43 | you're resuming. 44 | 45 | 12 46 | 00:00:42,150 --> 00:00:43,640 47 | I know we can go through it together. 48 | 49 | 13 50 | 00:00:43,920 --> 00:00:47,960 51 | So here we have the hotel controller and I went through the same steps there. 52 | 53 | 14 54 | 00:00:47,960 --> 00:00:55,920 55 | I clicked, controllers clicked, add data controller, a blank API controller called the total controller. 56 | 57 | 15 58 | 00:00:56,160 --> 00:01:03,480 59 | I went ahead and injected basically the same services that were in the control controller and initialize 60 | 61 | 16 62 | 00:01:03,480 --> 00:01:05,190 63 | them in the constructor. 64 | 65 | 17 66 | 00:01:06,360 --> 00:01:10,500 67 | Know everything pretty much is identical. 68 | 69 | 18 70 | 00:01:10,500 --> 00:01:15,660 71 | The only things that really changed were my variable names, because obviously I'm not going to call 72 | 73 | 19 74 | 00:01:15,660 --> 00:01:18,270 75 | this one countries if we're getting hotel. 76 | 77 | 20 78 | 00:01:18,280 --> 00:01:25,680 79 | So get hotels instead of get countries, get hotels instead of get hotels and similarily, you'd want 80 | 81 | 21 82 | 00:01:25,680 --> 00:01:27,610 83 | to get to a hotel by IBE. 84 | 85 | 22 86 | 00:01:29,160 --> 00:01:35,520 87 | Another thing that I would want to point out would be the mapping where mapping to hotel detail. 88 | 89 | 23 90 | 00:01:35,880 --> 00:01:42,470 91 | And the final thing would be that I've kind of added more attributes. 92 | 93 | 24 94 | 00:01:42,480 --> 00:01:50,400 95 | So as you see the attributes kind of Eden, it indicates that at least swagga and I mean, it does dictate 96 | 97 | 25 98 | 00:01:50,400 --> 00:01:57,530 99 | the behavior, but sluggard does depend on it's also to know how to formulate that documentation. 100 | 101 | 26 102 | 00:01:57,870 --> 00:02:02,230 103 | So right here, I'm letting her know that this method produces 200. 104 | 105 | 27 106 | 00:02:02,430 --> 00:02:08,820 107 | It also produces five hundred, because if you recall, when we looked at Strugar and a return to five 108 | 109 | 28 110 | 00:02:08,820 --> 00:02:13,080 111 | hundred, you would have seen some things being undocumented underneath that 500 error. 112 | 113 | 29 114 | 00:02:13,440 --> 00:02:20,730 115 | And so we want to just make sure that Swiger contextually tells as much information to the developer 116 | 117 | 30 118 | 00:02:20,730 --> 00:02:22,760 119 | as possible at any given time. 120 | 121 | 31 122 | 00:02:23,130 --> 00:02:24,480 123 | So that I bring up swagga. 124 | 125 | 32 126 | 00:02:24,690 --> 00:02:30,130 127 | You're going to see the segregation country different from hotel. 128 | 129 | 33 130 | 00:02:30,560 --> 00:02:31,130 131 | All right. 132 | 133 | 34 134 | 00:02:31,170 --> 00:02:32,430 135 | I hope you're seeing this. 136 | 137 | 35 138 | 00:02:32,670 --> 00:02:40,230 139 | And if we look at hotel or any one of these that the attributes was both attributes were added to, 140 | 141 | 36 142 | 00:02:40,380 --> 00:02:43,830 143 | you could see that the five hundred wasn't there initially to see the two. 144 | 145 | 37 146 | 00:02:44,220 --> 00:02:46,420 147 | No, 500 wasn't there initially. 148 | 149 | 38 150 | 00:02:46,830 --> 00:02:47,450 151 | All right. 152 | 153 | 39 154 | 00:02:47,760 --> 00:02:53,760 155 | So that does work out for someone to use postmen to do some testing. 156 | 157 | 40 158 | 00:02:53,770 --> 00:02:56,520 159 | So I still have my test from the time. 160 | 161 | 41 162 | 00:02:56,520 --> 00:02:59,950 163 | And the thing is, with Postman, you can always just start a new type, right? 164 | 165 | 42 166 | 00:03:00,300 --> 00:03:10,590 167 | So instead of using one tub to continuously be changing, I went to have one for the get to know parameter 168 | 169 | 43 170 | 00:03:11,250 --> 00:03:12,230 171 | street over here. 172 | 173 | 44 174 | 00:03:12,690 --> 00:03:14,070 175 | So this is no parameter. 176 | 177 | 45 178 | 00:03:14,130 --> 00:03:15,660 179 | Let's see if that works. 180 | 181 | 46 182 | 00:03:17,100 --> 00:03:19,560 183 | All right, so I really didn't test Michael before. 184 | 185 | 47 186 | 00:03:19,590 --> 00:03:23,540 187 | No, I wrote it and I didn't test it, and I'm happy to see that it's working. 188 | 189 | 48 190 | 00:03:23,940 --> 00:03:24,530 191 | All right. 192 | 193 | 49 194 | 00:03:24,810 --> 00:03:29,070 195 | And then the one with the parameter. 196 | 197 | 50 198 | 00:03:30,110 --> 00:03:38,550 199 | That also works, and for now, that's all there is to setting up our controllers. 200 | 201 | 51 202 | 00:03:38,750 --> 00:03:39,100 203 | All right. 204 | 205 | 52 206 | 00:03:39,110 --> 00:03:44,660 207 | So as many controllers as you might have, of course, variations and based on context, certain things 208 | 209 | 53 210 | 00:03:44,660 --> 00:03:45,350 211 | may differ. 212 | 213 | 54 214 | 00:03:45,650 --> 00:03:53,550 215 | But we have a good template upon which we can build our get operations. 216 | 217 | 55 218 | 00:03:53,580 --> 00:03:53,960 219 | All right. 220 | 221 | 56 222 | 00:03:54,200 --> 00:03:57,440 223 | So you can go ahead and just start this off. 224 | 225 | 57 226 | 00:03:57,620 --> 00:04:03,140 227 | And then when we come back, we'll be pushing our changes to our repositories. 228 | -------------------------------------------------------------------------------- /1. Overview.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:01,090 --> 00:00:02,960 3 | Welcome back, guys, at this point. 4 | 5 | 2 6 | 00:00:02,980 --> 00:00:09,640 7 | We have basically completed at least the bulk of our configurations as we go along, we may see the 8 | 9 | 3 10 | 00:00:09,640 --> 00:00:11,170 11 | need to include all those things. 12 | 13 | 4 14 | 00:00:11,530 --> 00:00:17,770 15 | But right now we want to start actually making our API work because outside of hitting F5 and seeing 16 | 17 | 5 18 | 00:00:17,770 --> 00:00:20,430 19 | Swiger and seeing the logs, nothing works. 20 | 21 | 6 22 | 00:00:20,980 --> 00:00:22,670 23 | We don't have an API just yet. 24 | 25 | 7 26 | 00:00:23,110 --> 00:00:28,600 27 | So what we want to do is actually start configuring our get end points. 28 | 29 | 8 30 | 00:00:28,600 --> 00:00:33,040 31 | And I'm going to explain exactly what the get endpoints mean. 32 | 33 | 9 34 | 00:00:34,710 --> 00:00:41,880 35 | So to start us off, we're going to just look at this weather forecast control that came with our project, 36 | 37 | 10 38 | 00:00:42,240 --> 00:00:48,810 39 | but it is actually just some sample code that kind of provides some context as to what we need to do 40 | 41 | 11 42 | 00:00:48,930 --> 00:00:51,510 43 | to get our get in point up and running. 44 | 45 | 12 46 | 00:00:52,480 --> 00:00:59,550 47 | So our controller, like I said before, actually controls what happens when a user requests information 48 | 49 | 13 50 | 00:00:59,550 --> 00:01:00,750 51 | and hits the controller. 52 | 53 | 14 54 | 00:01:01,110 --> 00:01:07,770 55 | The endpoints are usually determined by our what we call actions, which are these functions that are 56 | 57 | 15 58 | 00:01:07,890 --> 00:01:10,410 59 | going to be defined inside of the controller. 60 | 61 | 16 62 | 00:01:10,710 --> 00:01:18,930 63 | And what it responds with are when the controller, the action is hit, rather, it does its computation 64 | 65 | 17 66 | 00:01:18,930 --> 00:01:25,650 67 | and then responds in a manner that the calling application or the client application that is trying 68 | 69 | 18 70 | 00:01:25,650 --> 00:01:30,940 71 | to access the API will know that this was a successful call maybe. 72 | 73 | 19 74 | 00:01:31,110 --> 00:01:37,410 75 | And generally speaking, whenever somebody calls, I get commodities in order to retrieve information. 76 | 77 | 20 78 | 00:01:37,410 --> 00:01:41,900 79 | Hence the word gets they're getting something or they expect to get something. 80 | 81 | 21 82 | 00:01:42,780 --> 00:01:51,450 83 | So within the context of this sample controller, we see that we when we call this end point, it is 84 | 85 | 22 86 | 00:01:51,450 --> 00:01:53,150 87 | going to return data. 88 | 89 | 23 90 | 00:01:53,160 --> 00:01:55,860 91 | So we are getting data granted. 92 | 93 | 24 94 | 00:01:55,860 --> 00:01:57,900 95 | It is very random data. 96 | 97 | 25 98 | 00:01:57,900 --> 00:02:00,150 99 | It's nothing to zero. 100 | 101 | 26 102 | 00:02:00,510 --> 00:02:05,940 103 | But the reality is that it is doing the simple command, which is getting so we have what we call this 104 | 105 | 27 106 | 00:02:05,940 --> 00:02:08,130 107 | HTP attribute. 108 | 109 | 28 110 | 00:02:08,470 --> 00:02:09,060 111 | Right. 112 | 113 | 29 114 | 00:02:09,060 --> 00:02:13,840 115 | And it is seeing it is defining the behavior of the function. 116 | 117 | 30 118 | 00:02:14,310 --> 00:02:22,680 119 | So when we actually test results and we can do that right here in Swiger, we just go ahead and pull 120 | 121 | 31 122 | 00:02:22,680 --> 00:02:27,510 123 | this down and they shows all of the examples of what we might get. 124 | 125 | 32 126 | 00:02:27,510 --> 00:02:29,970 127 | We can click, try it out and click execute. 128 | 129 | 33 130 | 00:02:30,300 --> 00:02:34,690 131 | And then it's going to show that this was the request that was sent. 132 | 133 | 34 134 | 00:02:34,710 --> 00:02:39,450 135 | So notice, there is no real indicator here to say or this slash get. 136 | 137 | 35 138 | 00:02:39,540 --> 00:02:42,330 139 | There is no indicator to see what the endpoint was. 140 | 141 | 36 142 | 00:02:42,340 --> 00:02:47,970 143 | We know the server based on the fact that when we run the application, that's our server address. 144 | 145 | 37 146 | 00:02:48,270 --> 00:02:53,430 147 | And then we know the controller that we're interacting with weather forecasts. 148 | 149 | 38 150 | 00:02:53,430 --> 00:02:53,820 151 | Right. 152 | 153 | 39 154 | 00:02:53,910 --> 00:02:56,100 155 | That's the name of our controller. 156 | 157 | 40 158 | 00:02:56,280 --> 00:03:00,150 159 | Weather forecast controller is a static keyword. 160 | 161 | 41 162 | 00:03:00,300 --> 00:03:02,700 163 | Ever control necessar naming convention. 164 | 165 | 42 166 | 00:03:03,240 --> 00:03:06,500 167 | But then I don't know which action it hit. 168 | 169 | 43 170 | 00:03:06,520 --> 00:03:11,700 171 | So what really happened is that I'm just going to set a break point here so we can see that when we 172 | 173 | 44 174 | 00:03:11,700 --> 00:03:15,050 175 | click execute, it actually hits that breakpoints. 176 | 177 | 45 178 | 00:03:15,060 --> 00:03:18,660 179 | It's calling this method and it's called a get. 180 | 181 | 46 182 | 00:03:19,710 --> 00:03:27,390 183 | And when I have five, it just returns with all the information that was being retrieved from that. 184 | 185 | 47 186 | 00:03:27,840 --> 00:03:34,680 187 | So what's really happening here is that based on the protocol and certain definitions that we're going 188 | 189 | 48 190 | 00:03:34,680 --> 00:03:42,390 191 | to be making here on each option, the way we formulate our requests, it will the controller will automatically 192 | 193 | 49 194 | 00:03:42,390 --> 00:03:44,550 195 | know which one we should hit. 196 | 197 | 50 198 | 00:03:44,940 --> 00:03:52,800 199 | And the context for this, the background behind this is that you don't want to get too granular with 200 | 201 | 51 202 | 00:03:52,800 --> 00:03:55,370 203 | your names for your actions. 204 | 205 | 52 206 | 00:03:55,370 --> 00:03:59,220 207 | So you don't want to say, get off, get one, get one by. 208 | 209 | 53 210 | 00:03:59,220 --> 00:04:01,020 211 | I'd get one by name. 212 | 213 | 54 214 | 00:04:01,600 --> 00:04:02,520 215 | You can call. 216 | 217 | 55 218 | 00:04:03,450 --> 00:04:05,610 219 | Well, you can actually call the action. 220 | 221 | 56 222 | 00:04:05,820 --> 00:04:10,580 223 | Basically, anything you want to say can give it its own name. 224 | 225 | 57 226 | 00:04:10,590 --> 00:04:14,580 227 | Of course there are standards surrounding that, but the reality is that if you have multiple gets, 228 | 229 | 58 230 | 00:04:14,580 --> 00:04:16,440 231 | you can name all of them the same get. 232 | 233 | 59 234 | 00:04:17,070 --> 00:04:26,520 235 | But you, based on the data that is required to retrieve the information you can stipulate which get 236 | 237 | 60 238 | 00:04:26,520 --> 00:04:27,390 239 | should get called. 240 | 241 | 61 242 | 00:04:27,930 --> 00:04:30,750 243 | So all of that once again, this is just the introduction. 244 | 245 | 62 246 | 00:04:30,760 --> 00:04:35,290 247 | So in the next video, we're going to create our own controller. 248 | 249 | 63 250 | 00:04:35,310 --> 00:04:40,980 251 | We're going to start off with the hotels, sorry, with the countries, and we'll see exactly how it 252 | 253 | 64 254 | 00:04:40,980 --> 00:04:41,370 255 | goes. 256 | 257 | 65 258 | 00:04:41,370 --> 00:04:47,970 259 | And we want to retrieve the countries, the listing of countries from the database through an API called. 260 | -------------------------------------------------------------------------------- /6. Explore JSON Web Tokens (JWT).srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,620 --> 00:00:07,210 3 | You guys will come back, so Randall, we want to start discussing our Gece on the Web tokens, but 4 | 5 | 2 6 | 00:00:07,220 --> 00:00:11,720 7 | before we go ahead and implement them, unwrite mountains of beautiful code. 8 | 9 | 3 10 | 00:00:12,020 --> 00:00:19,040 11 | To do that, I want us to have a full understanding of the purpose that they serve in the whole workflow, 12 | 13 | 4 14 | 00:00:19,040 --> 00:00:21,980 15 | the API security and everything. 16 | 17 | 5 18 | 00:00:22,820 --> 00:00:30,100 19 | So there is a leading authority, at least in my view, there are leading authority in the form of zero, 20 | 21 | 6 22 | 00:00:30,110 --> 00:00:31,100 23 | if I'm not mistaken. 24 | 25 | 7 26 | 00:00:31,100 --> 00:00:34,970 27 | They're probably pioneers for this kind of protocol. 28 | 29 | 8 30 | 00:00:35,180 --> 00:00:41,600 31 | But you can go to JWT that aisle, and you land on the same page that I have here, where they display 32 | 33 | 9 34 | 00:00:41,600 --> 00:00:46,310 35 | to some token and kind of show you the breakdown. 36 | 37 | 10 38 | 00:00:46,520 --> 00:00:54,920 39 | So we're going to discuss exactly why tokens are necessary and what exactly they tell basically when 40 | 41 | 11 42 | 00:00:54,920 --> 00:00:56,140 43 | when they're being recorded. 44 | 45 | 12 46 | 00:00:57,440 --> 00:01:06,380 47 | So let's say, once again, the person attempts to log in to our API or they attempt to access our resource 48 | 49 | 13 50 | 00:01:06,620 --> 00:01:07,660 51 | from our API. 52 | 53 | 14 54 | 00:01:08,480 --> 00:01:10,610 55 | We have restricted access. 56 | 57 | 15 58 | 00:01:11,150 --> 00:01:17,720 59 | So we are telling them that we need to know who you are and what you are able to do. 60 | 61 | 16 62 | 00:01:18,440 --> 00:01:24,710 63 | But then I need to make sure that you are somebody who should be able to access my system to begin with. 64 | 65 | 17 66 | 00:01:24,720 --> 00:01:25,000 67 | Right. 68 | 69 | 18 70 | 00:01:25,520 --> 00:01:34,310 71 | So are talking here pretty much would be issued to them after a successful login attempts so they would 72 | 73 | 19 74 | 00:01:34,310 --> 00:01:40,430 75 | pass over their username and password that we already have stored in our system because they're registered. 76 | 77 | 20 78 | 00:01:40,760 --> 00:01:47,330 79 | Once we verify that they are who they say they are, we're going to give them a tool can with information 80 | 81 | 21 82 | 00:01:47,330 --> 00:01:54,710 83 | that we have on them so that when they are making subsequent requests, they can use this tool kit instead 84 | 85 | 22 86 | 00:01:54,710 --> 00:01:57,180 87 | of trying to log in every single time. 88 | 89 | 23 90 | 00:01:57,620 --> 00:02:04,370 91 | So this token would represent a hash or some encoded representation of all the information that we have 92 | 93 | 24 94 | 00:02:04,370 --> 00:02:11,010 95 | for them that would that could include their username, their password, not their password, back to 96 | 97 | 25 98 | 00:02:11,330 --> 00:02:18,830 99 | their username, their email address, if they're different, how long we're allowing them to use this 100 | 101 | 26 102 | 00:02:18,830 --> 00:02:22,610 103 | token to access the system, what role they have. 104 | 105 | 27 106 | 00:02:22,760 --> 00:02:28,610 107 | And this although one called claims, which means that you are able to do this, but not that sort of. 108 | 109 | 28 110 | 00:02:28,820 --> 00:02:29,140 111 | Right. 112 | 113 | 29 114 | 00:02:29,480 --> 00:02:37,520 115 | So those are the things that we encode in this huge string and send back to them after they have successfully 116 | 117 | 30 118 | 00:02:37,520 --> 00:02:38,070 119 | logged in. 120 | 121 | 31 122 | 00:02:38,070 --> 00:02:45,440 123 | Not the benefit of this is that on their side, they don't have to keep on calling the login because 124 | 125 | 32 126 | 00:02:45,440 --> 00:02:50,940 127 | remember that we're not keeping the session to know if they were logged in previously or not. 128 | 129 | 33 130 | 00:02:51,170 --> 00:02:55,550 131 | So instead of them having to try and log in every single time, they're going to make an API call, 132 | 133 | 34 134 | 00:02:55,760 --> 00:03:01,850 135 | they log in once, get this token and then make every other call with this token attached to the request 136 | 137 | 35 138 | 00:03:02,150 --> 00:03:07,820 139 | on our side, when we get the request and we see that there is a token, we decode it, validate that 140 | 141 | 36 142 | 00:03:07,820 --> 00:03:15,030 143 | it came from us, and then redirect them accordingly or provide the response accordingly. 144 | 145 | 37 146 | 00:03:15,050 --> 00:03:19,370 147 | So that is what JWT security is all about. 148 | 149 | 38 150 | 00:03:20,080 --> 00:03:23,930 151 | You'll see that this stream is actually color coded red. 152 | 153 | 39 154 | 00:03:24,140 --> 00:03:27,800 155 | I think that's I'm going to say lavender and blue. 156 | 157 | 40 158 | 00:03:28,550 --> 00:03:28,970 159 | Right. 160 | 161 | 41 162 | 00:03:29,270 --> 00:03:34,550 163 | And pretty much each section is explained over here. 164 | 165 | 42 166 | 00:03:34,560 --> 00:03:40,940 167 | So this is the heterosexual one which contains what harshing algorithm was used, as well as the type 168 | 169 | 43 170 | 00:03:40,940 --> 00:03:43,160 171 | of token which in this case is JWT. 172 | 173 | 44 174 | 00:03:43,430 --> 00:03:45,880 175 | The middle section has the payload or the data. 176 | 177 | 45 178 | 00:03:45,890 --> 00:03:51,410 179 | So the payload is really to see all of this information is what I know about this user. 180 | 181 | 46 182 | 00:03:51,410 --> 00:03:56,120 183 | So the more information we put into it is the bigger the section will get. 184 | 185 | 47 186 | 00:03:56,420 --> 00:03:56,810 187 | Right. 188 | 189 | 48 190 | 00:03:56,990 --> 00:04:02,150 191 | And over to the right, you see here they're showing you what exactly is included in this payload. 192 | 193 | 49 194 | 00:04:02,160 --> 00:04:09,230 195 | So the payload can have the expiration date of the token or date on time because usually you are talking 196 | 197 | 50 198 | 00:04:09,230 --> 00:04:11,420 199 | for a finite period of time. 200 | 201 | 51 202 | 00:04:11,870 --> 00:04:16,250 203 | So as long as this token is valid, then they don't have to log in again. 204 | 205 | 52 206 | 00:04:17,240 --> 00:04:21,530 207 | As soon as it's invalid, then they may want to log in and get their first token and then continue. 208 | 209 | 53 210 | 00:04:21,560 --> 00:04:24,890 211 | So that's what that that's the purpose that one serves. 212 | 213 | 54 214 | 00:04:25,280 --> 00:04:30,980 215 | And then the parts now with the signature piece of the server is the signature part to verify whether 216 | 217 | 55 218 | 00:04:30,980 --> 00:04:34,020 219 | the token contains a valid information or not. 220 | 221 | 56 222 | 00:04:34,040 --> 00:04:39,590 223 | So if we issued the token, then we would want to verify that it came from us because anybody can really 224 | 225 | 57 226 | 00:04:40,070 --> 00:04:47,660 227 | encode this kind of data, but they don't want to make sure that they have done here encoded relative 228 | 229 | 58 230 | 00:04:47,660 --> 00:04:53,540 231 | to our issuing key to make sure that it really came from us and it is valid in our system. 232 | 233 | 59 234 | 00:04:56,120 --> 00:05:03,560 235 | So I hope that cleared up some of the let's say the gray area is our own, what JWT is and why we're 236 | 237 | 60 238 | 00:05:03,560 --> 00:05:04,160 239 | using it. 240 | 241 | 61 242 | 00:05:04,430 --> 00:05:10,130 243 | When we come back, we will start changing up our configurations in our API to facilitate its use. 244 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /4. CORS Configuration.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,740 --> 00:00:06,650 3 | Welcome back, guys, in this lesson, we're going to be configuring our course policy, of course, 4 | 5 | 2 6 | 00:00:06,650 --> 00:00:15,440 7 | is an acronym for Cross Origin Resource Sharing, and this is just a mechanism that allows you to allow 8 | 9 | 3 10 | 00:00:15,440 --> 00:00:20,360 11 | or restrict the sharing of resources across domains. 12 | 13 | 4 14 | 00:00:20,750 --> 00:00:22,880 15 | So let me say that in a bit more English. 16 | 17 | 5 18 | 00:00:23,270 --> 00:00:30,470 19 | When somebody who is not on your network tries to access your API by default, your API is going to 20 | 21 | 6 22 | 00:00:30,470 --> 00:00:34,010 23 | reject that access request. 24 | 25 | 7 26 | 00:00:34,280 --> 00:00:34,690 27 | All right. 28 | 29 | 8 30 | 00:00:35,000 --> 00:00:41,800 31 | So if I develop an internal API to be used in my company and somebody from outside my company with a 32 | 33 | 9 34 | 00:00:41,810 --> 00:00:49,550 35 | completely different IP address and everything tries to consume the API or talk to the API, then it's 36 | 37 | 10 38 | 00:00:49,550 --> 00:00:54,830 39 | going to automatically know that, hey, well, I can't send you any information because I don't know 40 | 41 | 11 42 | 00:00:54,830 --> 00:00:55,020 43 | you. 44 | 45 | 12 46 | 00:00:55,370 --> 00:01:05,060 47 | So we want to configure this policy to at least facilitate some conversation with sources are requesters 48 | 49 | 13 50 | 00:01:05,060 --> 00:01:08,250 51 | that are not necessarily in our network. 52 | 53 | 14 54 | 00:01:08,690 --> 00:01:09,040 55 | All right. 56 | 57 | 15 58 | 00:01:09,050 --> 00:01:10,740 59 | So I've actually run into this before. 60 | 61 | 16 62 | 00:01:10,760 --> 00:01:18,890 63 | I developed an API for my company for third party use, and I spent some time debugging why this company 64 | 65 | 17 66 | 00:01:18,890 --> 00:01:23,610 67 | couldn't access the API that was clearly working on my machine and every other machine around me. 68 | 69 | 18 70 | 00:01:23,870 --> 00:01:27,170 71 | And then after digging, I realized it was the course policy. 72 | 73 | 19 74 | 00:01:27,470 --> 00:01:30,380 75 | So sometimes you live on, you learn, you learn through experience. 76 | 77 | 20 78 | 00:01:30,530 --> 00:01:36,470 79 | Well, I'm here to just let you know what configurations you can put in place from the get go to kind 80 | 81 | 21 82 | 00:01:36,470 --> 00:01:38,480 83 | of avoid certain busywork. 84 | 85 | 22 86 | 00:01:38,960 --> 00:01:45,890 87 | So in order to add this policy, what we're going to do is in our startup case file and I'm just going 88 | 89 | 23 90 | 00:01:45,890 --> 00:01:48,530 91 | to add to your order does matter to some extent. 92 | 93 | 24 94 | 00:01:48,530 --> 00:01:51,240 95 | But right now we're not really focusing on the order. 96 | 97 | 25 98 | 00:01:51,260 --> 00:01:58,010 99 | We just want to get our configurations in someone to see services, not add. 100 | 101 | 26 102 | 00:01:58,910 --> 00:01:59,870 103 | Cause. 104 | 105 | 27 106 | 00:02:01,820 --> 00:02:05,300 107 | And then I'll just put the semicolon there. 108 | 109 | 28 110 | 00:02:05,330 --> 00:02:10,900 111 | So when we say, of course, we need to add the policy, like CRS needs to know how to behave. 112 | 113 | 29 114 | 00:02:10,930 --> 00:02:11,230 115 | Right. 116 | 117 | 30 118 | 00:02:11,600 --> 00:02:16,970 119 | So the same way that when we're setting up the other the Swiger, Jen Psaki would say, see? 120 | 121 | 31 122 | 00:02:17,150 --> 00:02:23,570 123 | And then they slam the arrow and then we can have multiple lines with multiple configurations. 124 | 125 | 32 126 | 00:02:23,570 --> 00:02:25,870 127 | You could see it within points and so on. 128 | 129 | 33 130 | 00:02:26,060 --> 00:02:27,380 131 | We're going to be doing that here. 132 | 133 | 34 134 | 00:02:27,380 --> 00:02:31,940 135 | So I'm going to see or you can use any tool can really doesn't it could be. 136 | 137 | 35 138 | 00:02:31,940 --> 00:02:34,190 139 | C could be or it could be the word options. 140 | 141 | 36 142 | 00:02:34,400 --> 00:02:37,070 143 | Like I said, do you see them using endpoints stone here. 144 | 145 | 37 146 | 00:02:37,400 --> 00:02:47,110 147 | So I just say or and then the lambda arrow and then what I'm going to do is open and close curly braces. 148 | 149 | 38 150 | 00:02:47,120 --> 00:02:50,750 151 | So that means I'm going to have a whole block of configuration. 152 | 153 | 39 154 | 00:02:50,750 --> 00:02:54,290 155 | So I'm just breaking the line so we can see clearly exactly what's what. 156 | 157 | 40 158 | 00:02:54,830 --> 00:02:59,060 159 | And then I'm going to say or not add policy. 160 | 161 | 41 162 | 00:03:00,970 --> 00:03:08,320 163 | All right, so I'm adding up policy, then I have to give it a name, so first Burm is the name, I'll 164 | 165 | 42 166 | 00:03:08,320 --> 00:03:14,440 167 | just call it cause policy, nothing too fancy or confusing. 168 | 169 | 43 170 | 00:03:14,440 --> 00:03:17,560 171 | So, of course, policy and then comma. 172 | 173 | 44 174 | 00:03:18,490 --> 00:03:21,000 175 | And then I have to define another lambdas. 176 | 177 | 45 178 | 00:03:21,020 --> 00:03:24,250 179 | I just call this one builder because now I'm going to be building the policy. 180 | 181 | 46 182 | 00:03:24,260 --> 00:03:30,580 183 | So Builder Lambda Arrow and I just break line. 184 | 185 | 47 186 | 00:03:32,290 --> 00:03:35,020 187 | So I going to say builder dot. 188 | 189 | 48 190 | 00:03:36,020 --> 00:03:37,260 191 | Allow any. 192 | 193 | 49 194 | 00:03:37,280 --> 00:03:39,750 195 | So here are all the options before I start setting them. 196 | 197 | 50 198 | 00:03:39,770 --> 00:03:44,900 199 | These are all the options you can allow any can disallow. 200 | 201 | 51 202 | 00:03:45,410 --> 00:03:46,630 203 | You can sit. 204 | 205 | 52 206 | 00:03:46,640 --> 00:03:57,170 207 | So if it is white listed or with certain headers, you can define whole your API will determine who 208 | 209 | 53 210 | 00:03:57,710 --> 00:04:06,350 211 | is allowed to access me or my resources and who is not for no for an occasional purposes, because later 212 | 213 | 54 214 | 00:04:06,350 --> 00:04:10,610 215 | on maybe we can look at the securing of it and how we mix and match. 216 | 217 | 55 218 | 00:04:10,610 --> 00:04:12,650 219 | But then once again, context is everything. 220 | 221 | 56 222 | 00:04:12,660 --> 00:04:19,850 223 | If you are developing an API for Internet and third party use, then you can't be too strict with the 224 | 225 | 57 226 | 00:04:19,850 --> 00:04:22,480 227 | API if ever anybody should be able to get on. 228 | 229 | 58 230 | 00:04:22,640 --> 00:04:27,170 231 | Otherwise, you're going to have an administrative overhead of trying to figure out who is who all the 232 | 233 | 59 234 | 00:04:27,170 --> 00:04:27,470 235 | time. 236 | 237 | 60 238 | 00:04:27,500 --> 00:04:29,030 239 | So I'm just going to say hello. 240 | 241 | 61 242 | 00:04:29,840 --> 00:04:30,980 243 | Any origin. 244 | 245 | 62 246 | 00:04:32,460 --> 00:04:38,760 247 | And I'm just going to chain along alone any method, meaning they can access every method that every 248 | 249 | 63 250 | 00:04:38,880 --> 00:04:46,910 251 | endpoint that is defined here, and then I'm going to say allow in the header, sorry I any header. 252 | 253 | 64 254 | 00:04:47,680 --> 00:04:48,290 255 | Right. 256 | 257 | 65 258 | 00:04:48,720 --> 00:04:54,650 259 | And then I'll close the briefs for the policy and then use semicolon. 260 | 261 | 66 262 | 00:04:54,660 --> 00:04:57,120 263 | So that's my course policy that's undefined. 264 | 265 | 67 266 | 00:04:57,120 --> 00:05:05,490 267 | So I'm just allowing every and anybody once you're coming to access my API, you can go ahead and use 268 | 269 | 68 270 | 00:05:05,490 --> 00:05:06,570 271 | the resources. 272 | 273 | 69 274 | 00:05:06,990 --> 00:05:15,410 275 | Once again, context is everything that will determine how strict you are with your your course policy. 276 | 277 | 70 278 | 00:05:15,960 --> 00:05:23,010 279 | No, after doing all of that, I'm No one to go down to configure and I'm going to let the app know 280 | 281 | 71 282 | 00:05:23,190 --> 00:05:25,280 283 | that it should use the course policy. 284 | 285 | 72 286 | 00:05:25,290 --> 00:05:32,280 287 | So right here I'm just going to set up not use cause. 288 | 289 | 73 290 | 00:05:34,780 --> 00:05:41,710 291 | There we go, and then he's going to say, OK, it does some overlord's, I'm going to tell it to the 292 | 293 | 74 294 | 00:05:41,710 --> 00:05:42,650 295 | Palestinians. 296 | 297 | 75 298 | 00:05:42,790 --> 00:05:47,500 299 | And so just by putting the quotation marks, it's an old saying, OK, what's a Palestinian sort of 300 | 301 | 76 302 | 00:05:47,500 --> 00:05:52,450 303 | Palestinian, as I just outlined on top is course policy. 304 | 305 | 77 306 | 00:05:52,930 --> 00:05:57,010 307 | So maybe you could make it a bit more informative. 308 | 309 | 78 310 | 00:05:57,040 --> 00:06:02,280 311 | You could see a loaf of bread because that's all it's really doing. 312 | 313 | 79 314 | 00:06:02,290 --> 00:06:08,680 315 | This policy is allowing someone to say use the policy that says, all right, so that's what the course 316 | 317 | 80 318 | 00:06:08,680 --> 00:06:10,270 319 | policy is really for. 320 | 321 | 81 322 | 00:06:10,600 --> 00:06:15,370 323 | So at this in this situation, we're not going to fully see the benefit of it. 324 | 325 | 82 326 | 00:06:15,760 --> 00:06:23,380 327 | But then if you've done any other project where you have the API and then you have an entirely different 328 | 329 | 83 330 | 00:06:23,380 --> 00:06:29,200 331 | project, which is the client project, which means it is being broadcast, it's a different IP address 332 | 333 | 84 334 | 00:06:29,200 --> 00:06:33,450 335 | than our port than the current API project. 336 | 337 | 85 338 | 00:06:33,700 --> 00:06:39,160 339 | Once they try to talk, that will not work until you have this policy in place. 340 | -------------------------------------------------------------------------------- /1. Configure Hosting Environment.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,640 --> 00:00:01,600 3 | Hey, guys, welcome back. 4 | 5 | 2 6 | 00:00:01,600 --> 00:00:08,770 7 | In this lesson, we'll start setting up our environment for a local deployment of our own when we see 8 | 9 | 3 10 | 00:00:08,770 --> 00:00:12,940 11 | a local deployment, this could easily be your personal machine. 12 | 13 | 4 14 | 00:00:12,970 --> 00:00:16,390 15 | So in my situation, I'll be deploying it on my personal machine. 16 | 17 | 5 18 | 00:00:16,690 --> 00:00:23,980 19 | But it could also be on a company machine or a server somewhere that this API needs to serve, you know, 20 | 21 | 6 22 | 00:00:24,010 --> 00:00:25,330 23 | across the network. 24 | 25 | 7 26 | 00:00:25,660 --> 00:00:31,900 27 | And they could potentially even be to the Internet, whatever the situation, teaching you or showing 28 | 29 | 8 30 | 00:00:31,900 --> 00:00:39,060 31 | you critical steps towards prepping this machine so that it can host your API. 32 | 33 | 9 34 | 00:00:40,060 --> 00:00:45,850 35 | So our journey starts off here where we have to download the dot net five runtime already of the SDK, 36 | 37 | 10 38 | 00:00:45,850 --> 00:00:47,680 39 | which we've been using for development. 40 | 41 | 11 42 | 00:00:48,040 --> 00:00:53,170 43 | But we want to make sure we have the wrong time and we can just get that hosting bundle for windows. 44 | 45 | 12 46 | 00:00:53,540 --> 00:01:01,120 47 | So when you do that, you launch your installer and then you go ahead and install it, go through security 48 | 49 | 13 50 | 00:01:01,120 --> 00:01:02,080 51 | checkpoints. 52 | 53 | 14 54 | 00:01:04,250 --> 00:01:10,220 55 | And once that is done, you can close that and then, you know, we're going to move on to something 56 | 57 | 15 58 | 00:01:10,800 --> 00:01:13,290 59 | else, our Internet information services. 60 | 61 | 16 62 | 00:01:13,310 --> 00:01:21,500 63 | So what we want to do is add so you can just go to your start menu and see add feature and then you 64 | 65 | 17 66 | 00:01:21,500 --> 00:01:25,230 67 | want to click turn Windows features on or off. 68 | 69 | 18 70 | 00:01:25,610 --> 00:01:30,680 71 | So once that is selected, this little box will pop up and you want to make sure that you select Internet 72 | 73 | 19 74 | 00:01:30,680 --> 00:01:32,000 75 | information services. 76 | 77 | 20 78 | 00:01:32,000 --> 00:01:34,600 79 | Once you do that, you're going to get that square. 80 | 81 | 21 82 | 00:01:34,610 --> 00:01:39,740 83 | That square means that, you know, it's not everything that is ticked, which is fine. 84 | 85 | 22 86 | 00:01:39,740 --> 00:01:41,570 87 | You don't need every single feature. 88 | 89 | 23 90 | 00:01:41,870 --> 00:01:46,550 91 | But I'm going to show you the ones that I have currently installed and then you can just go through 92 | 93 | 24 94 | 00:01:46,550 --> 00:01:49,620 95 | and make sure that those are also on your side. 96 | 97 | 25 98 | 00:01:50,090 --> 00:01:55,940 99 | So I have the management console and then I have these libraries for application development feature. 100 | 101 | 26 102 | 00:01:55,950 --> 00:01:57,860 103 | So you can make sure that you take these off. 104 | 105 | 27 106 | 00:01:58,190 --> 00:02:01,940 107 | Maybe you don't need all of them, but it works for me with these. 108 | 109 | 28 110 | 00:02:01,940 --> 00:02:04,610 111 | So I would recommend that you make sure you have those. 112 | 113 | 29 114 | 00:02:05,060 --> 00:02:09,350 115 | And then for features, you can go ahead and take those. 116 | 117 | 30 118 | 00:02:10,270 --> 00:02:17,470 119 | Health and diagnostics, once that section is actually optional, but I recommend that you get the logging 120 | 121 | 31 122 | 00:02:17,470 --> 00:02:23,790 123 | section and then performance features basic authentication and others. 124 | 125 | 32 126 | 00:02:23,830 --> 00:02:29,360 127 | So once you have those, you can click, OK, and then it may take a while to install. 128 | 129 | 33 130 | 00:02:29,380 --> 00:02:33,580 131 | I already have them, so I don't need to wait for them to install. 132 | 133 | 34 134 | 00:02:33,580 --> 00:02:37,710 135 | But once they finish installing, then you can resume this video. 136 | 137 | 35 138 | 00:02:38,230 --> 00:02:45,720 139 | So once you're sure that you have is or that process is finished to make sure you have so you can just 140 | 141 | 36 142 | 00:02:45,730 --> 00:02:50,860 143 | go to your start menu and type in I guess, and then you'll see it pop up. 144 | 145 | 37 146 | 00:02:51,280 --> 00:02:58,240 147 | And then when you launch, you get this console showing you your server and all of the sites that you 148 | 149 | 38 150 | 00:02:58,240 --> 00:03:00,690 151 | have currently listed under there. 152 | 153 | 39 154 | 00:03:00,870 --> 00:03:01,100 155 | Right. 156 | 157 | 40 158 | 00:03:01,690 --> 00:03:03,910 159 | To make sure that it's working. 160 | 161 | 41 162 | 00:03:03,940 --> 00:03:12,160 163 | You can actually just click on default website and go to browse and then it will show you this page, 164 | 165 | 42 166 | 00:03:12,160 --> 00:03:15,000 167 | which shows you that you're now seeing your server. 168 | 169 | 43 170 | 00:03:15,820 --> 00:03:21,280 171 | Now, another essential part of setting up your local environment will be to make sure that your database 172 | 173 | 44 174 | 00:03:21,280 --> 00:03:23,800 175 | server is installed and running. 176 | 177 | 45 178 | 00:03:24,340 --> 00:03:27,940 179 | So when we talk about the database server, we have a few options. 180 | 181 | 46 182 | 00:03:27,940 --> 00:03:29,170 183 | In an enterprise setting. 184 | 185 | 47 186 | 00:03:29,170 --> 00:03:33,070 187 | You probably already have it or you should have it. 188 | 189 | 48 190 | 00:03:33,070 --> 00:03:37,870 191 | You can check with your system administrator whatever you need to do, but you just go ahead and make 192 | 193 | 49 194 | 00:03:37,870 --> 00:03:40,450 195 | sure you have a server on a personal level. 196 | 197 | 50 198 | 00:03:40,720 --> 00:03:43,720 199 | If you don't already have it, you have two options. 200 | 201 | 51 202 | 00:03:43,720 --> 00:03:46,630 203 | You have either developer or express. 204 | 205 | 52 206 | 00:03:46,630 --> 00:03:51,700 207 | So Express is very free, no licensing required at all. 208 | 209 | 53 210 | 00:03:52,210 --> 00:04:00,400 211 | And but then it has some limitations on a personal level versus fine developer gives you far more features 212 | 213 | 54 214 | 00:04:00,400 --> 00:04:02,260 215 | and it's actually a full poleward. 216 | 217 | 55 218 | 00:04:02,260 --> 00:04:07,960 219 | So it's a much bigger download and a much bigger test to have it installed gives the system many more 220 | 221 | 56 222 | 00:04:07,960 --> 00:04:11,170 223 | features for this deployment. 224 | 225 | 57 226 | 00:04:11,170 --> 00:04:16,300 227 | You probably can get away with Express, but then maybe if you're thinking about longevity, you probably 228 | 229 | 58 230 | 00:04:16,480 --> 00:04:21,160 231 | just want to get developers so you have everything you need so you can go ahead and download that. 232 | 233 | 59 234 | 00:04:21,220 --> 00:04:27,700 235 | Insolation is pretty straightforward and at the end of it you be prompted to install the management 236 | 237 | 60 238 | 00:04:27,700 --> 00:04:28,360 239 | studio. 240 | 241 | 61 242 | 00:04:28,450 --> 00:04:35,920 243 | And just in case you missed that step, you can always just Google SSME, which is short for Server 244 | 245 | 62 246 | 00:04:35,920 --> 00:04:42,310 247 | Management Studio, and once you go through that, you can always just download a management studio 248 | 249 | 63 250 | 00:04:42,610 --> 00:04:47,440 251 | through this medium also, which is also a straightforward installation. 252 | 253 | 64 254 | 00:04:47,830 --> 00:04:53,710 255 | So to launch the management studio after it's installed and to connect to your database server, you 256 | 257 | 65 258 | 00:04:53,710 --> 00:05:00,790 259 | can go ahead and click the icon and you'll see this splash launching screen and to connect to the server 260 | 261 | 66 262 | 00:05:00,790 --> 00:05:02,260 263 | you love to put in the server name. 264 | 265 | 67 266 | 00:05:02,270 --> 00:05:06,940 267 | So I have two servers running on, a few servers running on my machine. 268 | 269 | 68 270 | 00:05:06,940 --> 00:05:14,140 271 | Right now I have a skua express, so I do have an instance of Escalon Express, but I also have an instance 272 | 273 | 69 274 | 00:05:14,140 --> 00:05:15,130 275 | of the developer. 276 | 277 | 70 278 | 00:05:15,460 --> 00:05:23,710 279 | So to get to Scale Express you can see a dot backslash Eskil Express that that really means localhost 280 | 281 | 71 282 | 00:05:23,710 --> 00:05:24,370 283 | also. 284 | 285 | 72 286 | 00:05:24,880 --> 00:05:25,270 287 | Right. 288 | 289 | 73 290 | 00:05:25,540 --> 00:05:31,300 291 | And then if you went to a developer, then you just need localhost so you wouldn't need any special 292 | 293 | 74 294 | 00:05:31,360 --> 00:05:32,110 295 | anything else. 296 | 297 | 75 298 | 00:05:32,650 --> 00:05:34,960 299 | So I'm going to use developer. 300 | 301 | 76 302 | 00:05:34,960 --> 00:05:42,340 303 | So if I say localhost and it will connect and I think of a few databases, not too many. 304 | 305 | 77 306 | 00:05:42,790 --> 00:05:47,980 307 | So we can proceed now before we move to the next step, I just want to encourage you make sure that 308 | 309 | 78 310 | 00:05:47,980 --> 00:05:54,160 311 | you have admin access or even if you don't have administrative access, if you're in an enterprise setting 312 | 313 | 79 314 | 00:05:54,160 --> 00:06:00,580 315 | where you're not in a position to be the administrator, that you at least have enough access are you 316 | 317 | 80 318 | 00:06:00,580 --> 00:06:04,950 319 | are working with somebody who has the access to carry out some of the actions here. 320 | 321 | 81 322 | 00:06:04,960 --> 00:06:11,500 323 | So a lot of the problems that people encounter when doing these kind of deployments outside of probably 324 | 325 | 82 326 | 00:06:11,500 --> 00:06:17,680 327 | missing out the library and not installing something, the next biggest issue is usually permissions 328 | 329 | 83 330 | 00:06:17,710 --> 00:06:19,800 331 | and other authorizations. 332 | 333 | 84 334 | 00:06:19,810 --> 00:06:20,090 335 | Right. 336 | 337 | 85 338 | 00:06:20,440 --> 00:06:22,980 339 | So just make sure that you're working with somebody. 340 | 341 | 86 342 | 00:06:22,990 --> 00:06:29,890 343 | If if that is the case, who has enough permissions to go around any potential roadblocks. 344 | 345 | 87 346 | 00:06:30,190 --> 00:06:36,400 347 | And if you're on your personal machine just or a machine that is yours to manage, just make sure that 348 | 349 | 88 350 | 00:06:36,400 --> 00:06:38,740 351 | you have administrative rights. 352 | -------------------------------------------------------------------------------- /3. Construct DELETE Endpoint.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,630 --> 00:00:08,160 3 | Welcome back, guys, in this lesson, we'll be exploring how we delete data through our API, so I've 4 | 5 | 2 6 | 00:00:08,160 --> 00:00:14,790 7 | already actually created this action, if you want to, can pause and activate it. 8 | 9 | 3 10 | 00:00:15,300 --> 00:00:20,480 11 | So I'm giving you a sneak preview as to what it needs to look like, at least initially. 12 | 13 | 4 14 | 00:00:20,490 --> 00:00:22,490 15 | The verb is http delete. 16 | 17 | 5 18 | 00:00:22,890 --> 00:00:28,350 19 | We need to let you know that it should expect some parameter in the form of ideas. 20 | 21 | 6 22 | 00:00:28,350 --> 00:00:30,490 23 | An integer, we authorize it. 24 | 25 | 7 26 | 00:00:30,930 --> 00:00:37,670 27 | This is another one that you probably want to enforce a rule for administrator because we're deleting. 28 | 29 | 8 30 | 00:00:39,300 --> 00:00:41,880 31 | Otherwise you can just leave it as authorized. 32 | 33 | 9 34 | 00:00:42,210 --> 00:00:48,390 35 | And we know that the response codes here would be four hundred to four and five hundred. 36 | 37 | 10 38 | 00:00:48,390 --> 00:00:52,230 39 | So you can pause and attempt it and then we can compare notes. 40 | 41 | 11 42 | 00:00:53,760 --> 00:01:03,300 43 | So what I have in this delete hotel action is a validation to make sure that the ID value makes sense. 44 | 45 | 12 46 | 00:01:03,330 --> 00:01:04,380 47 | That's number one. 48 | 49 | 13 50 | 00:01:05,070 --> 00:01:09,780 51 | So we do that and then we rejected as a buddy request. 52 | 53 | 14 54 | 00:01:09,780 --> 00:01:13,090 55 | If it doesn't make sense, then I go on to try. 56 | 57 | 15 58 | 00:01:13,140 --> 00:01:20,570 59 | We know that our catch is already logging and returning US status codes are five hundred. 60 | 61 | 16 62 | 00:01:21,060 --> 00:01:28,650 63 | But then when it tries operation, what it does is it retrieves the hotel with the ID that was passed 64 | 65 | 17 66 | 00:01:28,650 --> 00:01:31,290 67 | and we check if that hotel exists. 68 | 69 | 18 70 | 00:01:31,290 --> 00:01:35,040 71 | Otherwise we once again see buddy request and log. 72 | 73 | 19 74 | 00:01:36,050 --> 00:01:44,050 75 | The error, otherwise, we go on to delete the photo and see more changes, then return or contents, 76 | 77 | 20 78 | 00:01:44,080 --> 00:01:48,370 79 | you see there wasn't really much to deleting the hotel. 80 | 81 | 21 82 | 00:01:48,920 --> 00:01:51,950 83 | So the same holds true for the country. 84 | 85 | 22 86 | 00:01:51,960 --> 00:01:54,250 87 | It's pretty much the same method. 88 | 89 | 23 90 | 00:01:54,260 --> 00:01:56,960 91 | We have the delete country with the same statuses. 92 | 93 | 24 94 | 00:01:57,290 --> 00:02:03,380 95 | If you want to extend the same permissions accordingly and we go through, we get the ID, we verify 96 | 97 | 25 98 | 00:02:03,380 --> 00:02:11,900 99 | that the volume makes sense and then we try the operation, getting the country validating that it is 100 | 101 | 26 102 | 00:02:12,200 --> 00:02:17,390 103 | not fake number and then going ahead and deleting it. 104 | 105 | 27 106 | 00:02:17,390 --> 00:02:21,590 107 | If it gets this far, we return and the content of two or four. 108 | 109 | 28 110 | 00:02:22,310 --> 00:02:29,510 111 | So what we want to do is test deleting a hotel versus testing, deleting a country. 112 | 113 | 29 114 | 00:02:29,530 --> 00:02:34,040 115 | And then you're going to see why I'm placing emphasis on those two tests. 116 | 117 | 30 118 | 00:02:34,700 --> 00:02:39,140 119 | So with the introduction of the delete endpoint, saga gets a bit more colorful. 120 | 121 | 31 122 | 00:02:39,440 --> 00:02:42,170 123 | You see delete being promoted here. 124 | 125 | 32 126 | 00:02:42,710 --> 00:02:49,670 127 | And what we're going to do is use postmen and attempt to delete. 128 | 129 | 33 130 | 00:02:49,670 --> 00:02:51,200 131 | So you have the endpoint. 132 | 133 | 34 134 | 00:02:51,800 --> 00:02:55,220 135 | You know, we need the ID value in the euro. 136 | 137 | 35 138 | 00:02:55,520 --> 00:02:58,910 139 | We're going to choose our verb as delete. 140 | 141 | 36 142 | 00:03:00,050 --> 00:03:05,310 143 | All right, and what I'm going to do is choose a hotel that I really don't want to hurt. 144 | 145 | 37 146 | 00:03:05,420 --> 00:03:09,740 147 | So I think this one this one was just a random test. 148 | 149 | 38 150 | 00:03:09,800 --> 00:03:15,560 151 | You see, it's still seeing string string, just like the default values that are in the payload example. 152 | 153 | 39 154 | 00:03:15,840 --> 00:03:19,840 155 | So I'm going to delete hotel with the I.D. number five. 156 | 157 | 40 158 | 00:03:19,850 --> 00:03:27,080 159 | So in my delete request, I put in the euro, slash five and then send. 160 | 161 | 41 162 | 00:03:28,390 --> 00:03:29,890 163 | Of course, I need to authorize. 164 | 165 | 42 166 | 00:03:29,920 --> 00:03:36,010 167 | So let me backtrack a bit and try and get a token there would go. 168 | 169 | 43 170 | 00:03:38,350 --> 00:03:45,460 171 | All right, here's a token, grab the talk and jump over authorization. 172 | 173 | 44 174 | 00:03:45,490 --> 00:03:51,240 175 | We're talking there we go then and we get to know content. 176 | 177 | 45 178 | 00:03:51,250 --> 00:03:56,790 179 | So if I look back at the list, I shouldn't see the auto side five. 180 | 181 | 46 182 | 00:03:57,070 --> 00:03:57,600 183 | There it is. 184 | 185 | 47 186 | 00:03:57,610 --> 00:03:59,170 187 | It goes further than six. 188 | 189 | 48 190 | 00:03:59,170 --> 00:04:00,440 191 | So five is gone. 192 | 193 | 49 194 | 00:04:01,120 --> 00:04:04,570 195 | No, that is how we would delete a hotel. 196 | 197 | 50 198 | 00:04:04,690 --> 00:04:13,090 199 | No, the thing with the country is that the country has hotels, so it's a bit riskier when we delete 200 | 201 | 51 202 | 00:04:13,090 --> 00:04:17,990 203 | a country that we're actually going to have to remove the hotels also. 204 | 205 | 52 206 | 00:04:18,010 --> 00:04:19,750 207 | So let's see what that looks like. 208 | 209 | 53 210 | 00:04:19,750 --> 00:04:21,130 211 | Someone to say country. 212 | 213 | 54 214 | 00:04:21,730 --> 00:04:30,520 215 | And looking back, I see that we have two in Cayman and we have that. 216 | 217 | 55 218 | 00:04:30,520 --> 00:04:32,260 219 | So we have one in Bahamas. 220 | 221 | 56 222 | 00:04:32,260 --> 00:04:36,310 223 | So let's try and delete the country of Bahamas. 224 | 225 | 57 226 | 00:04:36,330 --> 00:04:41,110 227 | It only has one or two soldiers bite the bullet and make the sacrifice of that one. 228 | 229 | 58 230 | 00:04:41,110 --> 00:04:43,430 231 | And we can always add it back later on. 232 | 233 | 59 234 | 00:04:43,990 --> 00:04:52,720 235 | So what I'm going to do is see a country with these three and go over here. 236 | 237 | 60 238 | 00:04:54,240 --> 00:04:58,890 239 | Put that there, all right, I need three and then send. 240 | 241 | 61 242 | 00:05:00,090 --> 00:05:07,050 243 | And we see we're getting a new content, so if I look at the list of countries that we look at, the 244 | 245 | 62 246 | 00:05:07,050 --> 00:05:08,880 247 | list of countries I shouldn't see. 248 | 249 | 63 250 | 00:05:09,900 --> 00:05:11,160 251 | Oh, I deleted. 252 | 253 | 64 254 | 00:05:12,420 --> 00:05:13,690 255 | Come on, that's fine. 256 | 257 | 65 258 | 00:05:13,710 --> 00:05:18,990 259 | So I need Keyman, so, you know, we only have two countries, one and two. 260 | 261 | 66 262 | 00:05:19,110 --> 00:05:21,530 263 | I thought I was deleting Bahamas apologies. 264 | 265 | 67 266 | 00:05:21,930 --> 00:05:27,320 267 | So that means none of the hotels that have I'd value three should be there. 268 | 269 | 68 270 | 00:05:27,330 --> 00:05:29,280 271 | So let me send. 272 | 273 | 69 274 | 00:05:29,490 --> 00:05:30,440 275 | And there it is. 276 | 277 | 70 278 | 00:05:30,450 --> 00:05:38,990 279 | So we have control with the one country with 80 to control, 31 one, et cetera. 280 | 281 | 71 282 | 00:05:39,000 --> 00:05:42,990 283 | So no country with ID three remains. 284 | 285 | 72 286 | 00:05:42,990 --> 00:05:50,550 287 | And that's because in our migration when we created the database so you can go to the first migration 288 | 289 | 73 290 | 00:05:50,560 --> 00:05:58,650 291 | file, I call the database created, you'll see in the configuration that the constraint on the foreign 292 | 293 | 74 294 | 00:05:58,650 --> 00:06:02,760 295 | key was that it said are differential action, not Kaskade. 296 | 297 | 75 298 | 00:06:03,210 --> 00:06:10,830 299 | So Cascade means that if you make any change to the parent meaning country, so you have country being 300 | 301 | 76 302 | 00:06:10,830 --> 00:06:13,170 303 | the parent and hotels are in a country. 304 | 305 | 77 306 | 00:06:13,170 --> 00:06:14,880 307 | So there the children are cards. 308 | 309 | 78 310 | 00:06:15,420 --> 00:06:20,460 311 | If you make any change to the country record, it would reflect on the hotels. 312 | 313 | 79 314 | 00:06:20,460 --> 00:06:25,320 315 | So in this case, the change we're making is that we're deleting the parent record. 316 | 317 | 80 318 | 00:06:25,320 --> 00:06:26,760 319 | So it's in undelete. 320 | 321 | 81 322 | 00:06:27,150 --> 00:06:33,330 323 | I want to Kaskade, meaning whatever you do to the parent, replicate that action across the child so 324 | 325 | 82 326 | 00:06:33,330 --> 00:06:34,620 327 | this can actually be changed. 328 | 329 | 83 330 | 00:06:34,620 --> 00:06:40,440 331 | But then you'd have to make the modification in the context file and then run another migration for 332 | 333 | 84 334 | 00:06:40,440 --> 00:06:44,430 335 | it to know that you want no action or to restrict meaning. 336 | 337 | 85 338 | 00:06:45,120 --> 00:06:46,410 339 | And I usually do. 340 | 341 | 86 342 | 00:06:46,410 --> 00:06:51,110 343 | I restrict because if there are children records, I don't want to delete the parent. 344 | 345 | 87 346 | 00:06:51,120 --> 00:06:56,730 347 | So that means once there are hotels associated with this country, you cannot believe the country has 348 | 349 | 88 350 | 00:06:56,730 --> 00:06:57,710 351 | what to do. 352 | 353 | 89 354 | 00:06:58,200 --> 00:07:04,620 355 | However, write notes on Kaskade and like you see when you delete that parent record, it's going to 356 | 357 | 90 358 | 00:07:04,620 --> 00:07:06,660 359 | cascade across all the hotels. 360 | 361 | 91 362 | 00:07:06,900 --> 00:07:08,430 363 | So you have to be careful with that. 364 | 365 | 92 366 | 00:07:08,430 --> 00:07:15,210 367 | Make sure that if that configuration obtains in your API, it is deliberate. 368 | 369 | 93 370 | 00:07:15,210 --> 00:07:16,860 371 | That is how you want it to work. 372 | 373 | 94 374 | 00:07:17,280 --> 00:07:23,160 375 | But this is something that can cause massive data loss if it is, if it goes untethered. 376 | -------------------------------------------------------------------------------- /2. Seed Data In Tables.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,780 --> 00:00:01,740 3 | Hey, guys, welcome back. 4 | 5 | 2 6 | 00:00:01,770 --> 00:00:05,460 7 | So in this lesson, we're going to be going through a process called seating. 8 | 9 | 3 10 | 00:00:05,460 --> 00:00:10,050 11 | So seating is where we provide some initial data to the database. 12 | 13 | 4 14 | 00:00:10,440 --> 00:00:16,650 15 | And what we're actually going to do is just hardcoded some records that when we perform a migration 16 | 17 | 5 18 | 00:00:16,650 --> 00:00:22,830 19 | afterwards, the migration will have instructions to create these records of the database with these 20 | 21 | 6 22 | 00:00:22,830 --> 00:00:27,600 23 | records, and it won't necessarily rely on user input. 24 | 25 | 7 26 | 00:00:27,610 --> 00:00:33,510 27 | So at least that will provide a nice basis for our testing when we start developing the API endpoints. 28 | 29 | 8 30 | 00:00:34,230 --> 00:00:42,750 31 | So what we want to do is go to our database context and where we're going to override a protected method 32 | 33 | 9 34 | 00:00:42,750 --> 00:00:45,480 35 | that is really inside of the DB context. 36 | 37 | 10 38 | 00:00:45,480 --> 00:00:54,480 39 | So protected override void on model creating and we are passing in the parameter model builder and I'm 40 | 41 | 11 42 | 00:00:54,480 --> 00:00:55,650 43 | just calling it builder. 44 | 45 | 12 46 | 00:00:56,880 --> 00:01:05,520 47 | And then what we'll see is something like a builder dot entity and then I have to specify which entity 48 | 49 | 13 50 | 00:01:05,520 --> 00:01:06,090 51 | I'm dealing with. 52 | 53 | 14 54 | 00:01:06,100 --> 00:01:13,470 55 | So we have control of hotel countries have to exist for hotels to exist. 56 | 57 | 15 58 | 00:01:14,580 --> 00:01:20,120 59 | And that's really because of how we define our records, right? 60 | 61 | 16 62 | 00:01:20,160 --> 00:01:25,230 63 | We said country and hotel as a foreign key, so we have to have the country before we can put in that 64 | 65 | 17 66 | 00:01:25,230 --> 00:01:25,850 67 | foreign key. 68 | 69 | 18 70 | 00:01:26,220 --> 00:01:31,240 71 | So would just say entity country that has data. 72 | 73 | 19 74 | 00:01:33,120 --> 00:01:34,050 75 | Oh, I'm sorry. 76 | 77 | 20 78 | 00:01:34,110 --> 00:01:37,340 79 | I'm missing a record period there. 80 | 81 | 21 82 | 00:01:37,410 --> 00:01:37,760 83 | Right. 84 | 85 | 22 86 | 00:01:37,810 --> 00:01:39,060 87 | So into the country. 88 | 89 | 23 90 | 00:01:39,060 --> 00:01:45,360 91 | And then open and close race has data data so open and close race. 92 | 93 | 24 94 | 00:01:45,840 --> 00:01:55,050 95 | And then inside of this, we're going to define some countries so we can define as many because it takes 96 | 97 | 25 98 | 00:01:55,050 --> 00:02:04,400 99 | an artist or has data really takes an array of type country so we can define a few records here. 100 | 101 | 26 102 | 00:02:04,410 --> 00:02:06,440 103 | So I'm just going to define three. 104 | 105 | 27 106 | 00:02:07,270 --> 00:02:07,740 107 | All right. 108 | 109 | 28 110 | 00:02:07,870 --> 00:02:12,710 111 | So new country record with ID equals one. 112 | 113 | 29 114 | 00:02:13,230 --> 00:02:18,420 115 | And once again, we are putting in the data, so we have to manually provide all of these values. 116 | 117 | 30 118 | 00:02:18,750 --> 00:02:21,390 119 | And this is the first country that I'm putting. 120 | 121 | 31 122 | 00:02:21,750 --> 00:02:26,220 123 | And the short name is Jim. 124 | 125 | 32 126 | 00:02:27,450 --> 00:02:37,200 127 | All right, and I'm just going to copy this and paste it cannot reduce the typing, so this would be 128 | 129 | 33 130 | 00:02:37,200 --> 00:02:39,150 131 | too and this would be three. 132 | 133 | 34 134 | 00:02:40,710 --> 00:02:45,060 135 | And the next one, let's see, Bahamas. 136 | 137 | 35 138 | 00:02:46,030 --> 00:02:57,160 139 | And the short name for Bahama, if I'm not mistaken, is the S and then the next one would be Cayman 140 | 141 | 36 142 | 00:02:57,160 --> 00:02:57,740 143 | Islands. 144 | 145 | 37 146 | 00:02:57,740 --> 00:03:03,850 147 | So I'm just choosing some destination, some popular tourist destinations where you'd probably want 148 | 149 | 38 150 | 00:03:03,850 --> 00:03:05,830 151 | to know what hotels are there. 152 | 153 | 39 154 | 00:03:05,830 --> 00:03:06,160 155 | Right. 156 | 157 | 40 158 | 00:03:06,700 --> 00:03:10,150 159 | So the short name for Cayman Islands would be. 160 | 161 | 41 162 | 00:03:11,380 --> 00:03:17,570 163 | All right, if I'm not all that accurate, then later on we can to it. 164 | 165 | 42 166 | 00:03:17,590 --> 00:03:20,690 167 | But for now, once again, these are example records, right? 168 | 169 | 43 170 | 00:03:21,070 --> 00:03:23,430 171 | So I did that for country. 172 | 173 | 44 174 | 00:03:23,590 --> 00:03:28,810 175 | I would just repeat that feat for the hotels. 176 | 177 | 45 178 | 00:03:28,810 --> 00:03:29,130 179 | Right. 180 | 181 | 46 182 | 00:03:29,170 --> 00:03:31,920 183 | So I'm just I just copied and pasted most of the code. 184 | 185 | 47 186 | 00:03:32,170 --> 00:03:41,560 187 | I noticed that at the hotel it is going to change the expected parameters to type hotel or whether it's 188 | 189 | 48 190 | 00:03:41,560 --> 00:03:44,070 191 | seeing objects because it's not getting hotels here. 192 | 193 | 49 194 | 00:03:44,080 --> 00:03:44,740 195 | So that's fine. 196 | 197 | 50 198 | 00:03:45,160 --> 00:03:47,170 199 | We'll just resort to hotel. 200 | 201 | 51 202 | 00:03:48,820 --> 00:03:53,900 203 | All right, I mean, what else did we have for the hotel address? 204 | 205 | 52 206 | 00:03:54,430 --> 00:03:58,170 207 | So let me get this. 208 | 209 | 53 210 | 00:03:58,180 --> 00:04:05,830 211 | So this is Sondos Resort and Spa, so I'm actually familiar with some of them. 212 | 213 | 54 214 | 00:04:06,160 --> 00:04:06,870 215 | Address. 216 | 217 | 55 218 | 00:04:06,880 --> 00:04:09,430 219 | Let's just keep it short and see the grill. 220 | 221 | 56 222 | 00:04:10,970 --> 00:04:18,520 223 | We already know the country, the country is Jamaica, so your idea would be one, right? 224 | 225 | 57 226 | 00:04:18,890 --> 00:04:27,170 227 | And then the rating is the last I heard it was, I'm going to say four point five. 228 | 229 | 58 230 | 00:04:27,170 --> 00:04:33,320 231 | But I know it's a five star kind of resort, so I'm just going to copy these details down. 232 | 233 | 59 234 | 00:04:35,200 --> 00:04:42,160 235 | All right, so we have a hotel for Jamaica. 236 | 237 | 60 238 | 00:04:42,310 --> 00:04:49,660 239 | I mean, just put a hotel per country just to make sure that we're spread right across and I'm just 240 | 241 | 61 242 | 00:04:49,660 --> 00:04:52,960 243 | going to make up something for Sunday for Bahamas. 244 | 245 | 62 246 | 00:04:53,200 --> 00:04:55,980 247 | So Bahamas, let's see. 248 | 249 | 63 250 | 00:04:55,990 --> 00:04:57,940 251 | They have grand. 252 | 253 | 64 254 | 00:04:59,690 --> 00:05:09,260 255 | Grand Paladium, so I know for sure Grand Paladium is a hotel in Jamaica, but for example sake we're 256 | 257 | 65 258 | 00:05:09,260 --> 00:05:12,470 259 | putting it there or puts it at their own place. 260 | 261 | 66 262 | 00:05:12,500 --> 00:05:12,960 263 | I'm sorry. 264 | 265 | 67 266 | 00:05:13,370 --> 00:05:16,160 267 | So this would be contrary to let's just do that. 268 | 269 | 68 270 | 00:05:16,270 --> 00:05:18,590 271 | And that's a four star. 272 | 273 | 69 274 | 00:05:20,760 --> 00:05:28,890 275 | Once again, this is not factual, we're just making up data, right, so far, cavemen, they have 276 | 277 | 70 278 | 00:05:28,890 --> 00:05:30,960 279 | comfort seats. 280 | 281 | 71 282 | 00:05:32,130 --> 00:05:35,280 283 | And dress that, said George. 284 | 285 | 72 286 | 00:05:37,290 --> 00:05:45,480 287 | On the contrary, these three, four cavemen and they're eating is four point three. 288 | 289 | 73 290 | 00:05:45,720 --> 00:05:46,110 291 | All right. 292 | 293 | 74 294 | 00:05:46,600 --> 00:05:52,950 295 | So that's also feeding some data into the database so this can get a bit crowded. 296 | 297 | 75 298 | 00:05:52,980 --> 00:05:57,030 299 | You could just collapse it like that so it doesn't take up too much space. 300 | 301 | 76 302 | 00:05:57,300 --> 00:06:05,010 303 | Or what I tend to do also is actually move it to underneath the DB definitions so that when I come to 304 | 305 | 77 306 | 00:06:05,010 --> 00:06:09,280 307 | make modifications to the device, it's always just stack them on top. 308 | 309 | 78 310 | 00:06:09,300 --> 00:06:11,840 311 | I don't have to scroll all the way past that. 312 | 313 | 79 314 | 00:06:12,240 --> 00:06:16,940 315 | There are ways to extract this and put them in other files and call the configurations also. 316 | 317 | 80 318 | 00:06:17,880 --> 00:06:22,650 319 | But then this is just a quick, quick, quick, quickly to see the data into the database. 320 | 321 | 81 322 | 00:06:23,100 --> 00:06:30,540 323 | So now that we have defined a few test records, the next thing that we want to do is add on migration. 324 | 325 | 82 326 | 00:06:30,570 --> 00:06:34,500 327 | So I'm going to add migration. 328 | 329 | 83 330 | 00:06:35,460 --> 00:06:44,910 331 | And this one, we're going to call the seeding data or so notice that each time the migration I try 332 | 333 | 84 334 | 00:06:44,920 --> 00:06:51,260 335 | to be descriptive enough with the name such that you can tell, oh, that's what happened at that point. 336 | 337 | 85 338 | 00:06:51,270 --> 00:06:53,760 339 | So it's almost like source control for the data. 340 | 341 | 86 342 | 00:06:53,800 --> 00:06:54,080 343 | Right. 344 | 345 | 87 346 | 00:06:54,480 --> 00:07:01,770 347 | And if you look at this, this migration file, you'll actually see here where it is insert data into 348 | 349 | 88 350 | 00:07:01,770 --> 00:07:02,520 351 | this table. 352 | 353 | 89 354 | 00:07:02,730 --> 00:07:06,870 355 | And these are the columns and those are the data volumes. 356 | 357 | 90 358 | 00:07:06,870 --> 00:07:07,330 359 | Right. 360 | 361 | 91 362 | 00:07:07,770 --> 00:07:12,740 363 | So it will go ahead and do all of that, right? 364 | 365 | 92 366 | 00:07:12,810 --> 00:07:13,180 367 | I don't know. 368 | 369 | 93 370 | 00:07:13,220 --> 00:07:17,510 371 | I turned my four point three to four point two, nine, nine and eight. 372 | 373 | 94 374 | 00:07:17,850 --> 00:07:23,930 375 | Not sure why, but that's just how it is going to reformat it so that they can do the insertions. 376 | 377 | 95 378 | 00:07:24,270 --> 00:07:32,250 379 | So the next thing that we want to do is update their database so that it can effectively carry out the 380 | 381 | 96 382 | 00:07:32,250 --> 00:07:34,850 383 | commands in the migration. 384 | 385 | 97 386 | 00:07:35,250 --> 00:07:37,110 387 | So it did see it done. 388 | 389 | 98 390 | 00:07:37,290 --> 00:07:40,920 391 | What I want to do is go back to my object explorer and then I'm going to right. 392 | 393 | 99 394 | 00:07:40,920 --> 00:07:44,310 395 | Click and view data on the country's table. 396 | 397 | 100 398 | 00:07:44,520 --> 00:07:45,470 399 | And there we go. 400 | 401 | 101 402 | 00:07:45,630 --> 00:07:47,910 403 | We have data in our database. 404 | 405 | 102 406 | 00:07:47,910 --> 00:07:55,590 407 | So we have successfully created our three countries and we can look at the matching. 408 | 409 | 103 410 | 00:07:56,700 --> 00:07:57,630 411 | Hotels. 412 | 413 | 104 414 | 00:07:58,680 --> 00:08:06,630 415 | All right, so that is how you can put initial data into your dominant core applications using entity, 416 | 417 | 105 418 | 00:08:06,630 --> 00:08:09,360 419 | framework core and the DB context. 420 | -------------------------------------------------------------------------------- /6. Rate Limiting and Throttling.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,650 --> 00:00:06,320 3 | Hey, guys will come back in this business and we'll be talking about limiting rate, limiting or throttling, 4 | 5 | 2 6 | 00:00:06,320 --> 00:00:14,300 7 | as it is also called, is a technique by which we impose certain limits on how often somebody can hit 8 | 9 | 3 10 | 00:00:14,300 --> 00:00:16,660 11 | our endpoint and actually get better. 12 | 13 | 4 14 | 00:00:17,030 --> 00:00:22,040 15 | So, of course, if somebody comes and bombards the endpoint as much as we have caching on all of these 16 | 17 | 5 18 | 00:00:22,040 --> 00:00:30,910 19 | things, the fact is that the endpoint is actually prone to a denial of service or delice attack. 20 | 21 | 6 22 | 00:00:31,370 --> 00:00:37,970 23 | And what we want to do is kind of put a mechanism in that when we detect too many requests from one 24 | 25 | 7 26 | 00:00:37,970 --> 00:00:44,660 27 | source, we can kind of block them and say, hey, here, overdoing it outside of the potential DOS 28 | 29 | 8 30 | 00:00:44,660 --> 00:00:45,200 31 | attack. 32 | 33 | 9 34 | 00:00:45,620 --> 00:00:53,660 35 | It actually helps us to kind of meter how often any one client accesses data and many very popular APIs 36 | 37 | 10 38 | 00:00:53,660 --> 00:00:54,710 39 | or their Google. 40 | 41 | 11 42 | 00:00:55,010 --> 00:00:57,010 43 | And I'm just going to say Google. 44 | 45 | 12 46 | 00:00:57,020 --> 00:01:04,100 47 | But all of those big players with APIs and their SDK is they all have some form of throttling. 48 | 49 | 13 50 | 00:01:04,340 --> 00:01:10,610 51 | If you read the requirements and the terms of use of their APIs that all have something in there to 52 | 53 | 14 54 | 00:01:10,610 --> 00:01:17,040 55 | see, you can request maybe one hundred per minute or 100 per hour, stuff like that. 56 | 57 | 15 58 | 00:01:18,170 --> 00:01:22,790 59 | So today we're going to be sitting in our API just to get a feel of how it's done. 60 | 61 | 16 62 | 00:01:23,060 --> 00:01:29,110 63 | And we'll be using the library, SB Natcore it's limit so we can just go ahead and install that. 64 | 65 | 17 66 | 00:01:29,540 --> 00:01:35,870 67 | And once that is installed, the next thing that we want to do is go over to our startup and allow our 68 | 69 | 18 70 | 00:01:35,870 --> 00:01:43,310 71 | application to use memory cache because it's going to use memory cache to kind of store and keep track 72 | 73 | 19 74 | 00:01:43,310 --> 00:01:47,490 75 | of who requested what and how many times they've requested it in the Timir. 76 | 77 | 20 78 | 00:01:47,930 --> 00:01:53,990 79 | So we can say services that add memory cache right there in the configure services function and then 80 | 81 | 21 82 | 00:01:53,990 --> 00:01:57,140 83 | we have some modifications to make the service extension. 84 | 85 | 22 86 | 00:01:57,770 --> 00:01:59,930 87 | So I have the code here already. 88 | 89 | 23 90 | 00:01:59,930 --> 00:02:03,500 91 | And this method is called configurator limiting. 92 | 93 | 24 94 | 00:02:03,590 --> 00:02:06,560 95 | And we already know the drillable, the service collection. 96 | 97 | 25 98 | 00:02:07,100 --> 00:02:14,150 99 | And what we're doing here is setting up a set of rules so you can just go ahead and copy the code and 100 | 101 | 26 102 | 00:02:14,150 --> 00:02:16,450 103 | include any missing references as you go along. 104 | 105 | 27 106 | 00:02:17,000 --> 00:02:24,040 107 | So very limited rules equals new list, really limit the rules so you can have multiple rules. 108 | 109 | 28 110 | 00:02:24,410 --> 00:02:30,650 111 | So we have to initialize a new rule object which allows us to specify the particular endpoints. 112 | 113 | 29 114 | 00:02:30,690 --> 00:02:35,140 115 | In this case, I'm seeing star, meaning every single endpoint is going to adhere to this rule. 116 | 117 | 30 118 | 00:02:35,510 --> 00:02:40,880 119 | So based on this structure, I can actually have multiple rules that can see, say, comma and do a 120 | 121 | 31 122 | 00:02:40,880 --> 00:02:41,720 123 | new rule. 124 | 125 | 32 126 | 00:02:43,290 --> 00:02:49,530 127 | And let me just jump in, because I can do a new rule, specify a particular endpoint and then change 128 | 129 | 33 130 | 00:02:49,530 --> 00:02:50,100 131 | the limit. 132 | 133 | 34 134 | 00:02:50,130 --> 00:02:54,720 135 | So this one is limited to one call per second, right? 136 | 137 | 35 138 | 00:02:55,320 --> 00:02:56,370 139 | That's kind of short. 140 | 141 | 36 142 | 00:02:56,620 --> 00:03:00,890 143 | I mean, we can say 10 seconds, one call every 10 seconds. 144 | 145 | 37 146 | 00:03:01,140 --> 00:03:06,120 147 | I can see one call every 10 minutes, you know, or one hundred calls. 148 | 149 | 38 150 | 00:03:06,240 --> 00:03:06,970 151 | It's up to you. 152 | 153 | 39 154 | 00:03:06,970 --> 00:03:08,190 155 | We can configurator. 156 | 157 | 40 158 | 00:03:08,250 --> 00:03:13,920 159 | And once again, if you have different rules per endpoint, you can go ahead and add these rules and 160 | 161 | 41 162 | 00:03:13,920 --> 00:03:17,140 163 | specify the particular endpoints to which they're applicable. 164 | 165 | 42 166 | 00:03:17,430 --> 00:03:19,500 167 | Right now, I'm just going to set a global rule. 168 | 169 | 43 170 | 00:03:19,770 --> 00:03:25,710 171 | So I'm just going to say all endpoints and I'm going to set it to something that is very small so that 172 | 173 | 44 174 | 00:03:25,710 --> 00:03:27,930 175 | we can see it in text writes. 176 | 177 | 45 178 | 00:03:27,930 --> 00:03:33,540 179 | I want to see within five seconds you're only allowed one call on any endpoint. 180 | 181 | 46 182 | 00:03:34,620 --> 00:03:40,710 183 | Then we go ahead and we say services that configure how we put in the IP rate limit options and we just 184 | 185 | 47 186 | 00:03:40,710 --> 00:03:46,650 187 | say options, not general rules, equal the limited rules that we just defined. 188 | 189 | 48 190 | 00:03:47,710 --> 00:03:54,630 191 | Outside of that, we need to add these Singleton services in the form of a limit counter store, and 192 | 193 | 49 194 | 00:03:54,630 --> 00:03:58,580 195 | that is going to be associated with memory kashrut limit kolender store. 196 | 197 | 50 198 | 00:03:58,770 --> 00:04:03,990 199 | So all of these are just bits of code that are required to support the library that we import. 200 | 201 | 51 202 | 00:04:04,000 --> 00:04:09,630 203 | This different library might implement differently, but this is the code required for this particular 204 | 205 | 52 206 | 00:04:09,630 --> 00:04:09,960 207 | library. 208 | 209 | 53 210 | 00:04:09,970 --> 00:04:12,380 211 | So you can just hit pause, write them off. 212 | 213 | 54 214 | 00:04:13,110 --> 00:04:16,800 215 | At this point, Intellisense will be filling them in because you already have the package. 216 | 217 | 55 218 | 00:04:18,020 --> 00:04:22,220 219 | Now, after we're done in service extensions, we're just going to head back over to startup and we're 220 | 221 | 56 222 | 00:04:22,220 --> 00:04:28,100 223 | going to add these two lines, services that configure it, limiting, which is the method we just configured 224 | 225 | 57 226 | 00:04:28,310 --> 00:04:32,650 227 | and the services that add context accessor. 228 | 229 | 58 230 | 00:04:32,660 --> 00:04:39,290 231 | So this gives us access to the actual controller and it's InnerWorkings when needed. 232 | 233 | 59 234 | 00:04:39,620 --> 00:04:45,160 235 | And then finally, we're going to add the middleware where Antipov routine. 236 | 237 | 60 238 | 00:04:45,170 --> 00:04:52,250 239 | So I'm going to put it right underneath the caching we have about use IP rate limit and of course, 240 | 241 | 61 242 | 00:04:52,250 --> 00:04:54,840 243 | include any missing references. 244 | 245 | 62 246 | 00:04:55,610 --> 00:05:02,060 247 | Now, there have been different response codes used when they're, you know, responding to, say, 248 | 249 | 63 250 | 00:05:02,060 --> 00:05:09,710 251 | too many requests in more recent times for twenty nine has been used, which literally means too many 252 | 253 | 64 254 | 00:05:09,710 --> 00:05:10,370 255 | requests. 256 | 257 | 65 258 | 00:05:10,610 --> 00:05:16,640 259 | But in the past I've witnessed platforms using four twenty, which means and Honsinger. 260 | 261 | 66 262 | 00:05:16,640 --> 00:05:18,390 263 | Com and other ones. 264 | 265 | 67 266 | 00:05:18,400 --> 00:05:21,260 267 | So let's test this also for country. 268 | 269 | 68 270 | 00:05:21,260 --> 00:05:29,180 271 | I'm going to hit send and if we observe the headers, you'll see that we get about three new headers. 272 | 273 | 69 274 | 00:05:29,330 --> 00:05:35,410 275 | X-Rite Limit excretes Rhymin limiter meaning and limited reset. 276 | 277 | 70 278 | 00:05:35,420 --> 00:05:35,730 279 | Right. 280 | 281 | 71 282 | 00:05:35,960 --> 00:05:40,130 283 | So it's showing you that the limit is five seconds. 284 | 285 | 72 286 | 00:05:40,160 --> 00:05:47,840 287 | You have no more remaining four to five second window and that the reset is going to be at this timestamp. 288 | 289 | 73 290 | 00:05:47,840 --> 00:05:54,650 291 | So if I hit this multiple times or I'm going to use a different endpoint because I think this one is 292 | 293 | 74 294 | 00:05:54,650 --> 00:05:55,790 295 | protected by caching. 296 | 297 | 75 298 | 00:05:55,790 --> 00:06:02,010 299 | So it might not based on my caching configuration, it's not going to violate the throttle. 300 | 301 | 76 302 | 00:06:02,510 --> 00:06:02,810 303 | All right. 304 | 305 | 77 306 | 00:06:02,810 --> 00:06:09,270 307 | So I'm going to use the hotel because remember that we set up all of those things on the country endpoint. 308 | 309 | 78 310 | 00:06:09,280 --> 00:06:12,830 311 | So let me go to a hotel, which I didn't really modify as much. 312 | 313 | 79 314 | 00:06:13,220 --> 00:06:19,400 315 | So I already sent a request and it's showing me the same headers limit, etc., etc. If I send another 316 | 317 | 80 318 | 00:06:19,400 --> 00:06:21,530 319 | one, we're done five seconds later. 320 | 321 | 81 322 | 00:06:21,560 --> 00:06:23,990 323 | It's okay if I send another one. 324 | 325 | 82 326 | 00:06:24,560 --> 00:06:26,060 327 | Too many requests. 328 | 329 | 83 330 | 00:06:26,150 --> 00:06:26,440 331 | Right. 332 | 333 | 84 334 | 00:06:26,470 --> 00:06:32,440 335 | So it says right after as basically saying send another request after one second. 336 | 337 | 85 338 | 00:06:32,450 --> 00:06:33,680 339 | So nothing came back. 340 | 341 | 86 342 | 00:06:33,680 --> 00:06:39,860 343 | But the message API calls quote, exceeded maximum admitted one per five seconds. 344 | 345 | 87 346 | 00:06:39,860 --> 00:06:40,170 347 | Right. 348 | 349 | 88 350 | 00:06:40,400 --> 00:06:44,750 351 | So it's letting me know that I need to try Abuk in this amount of time. 352 | 353 | 89 354 | 00:06:45,110 --> 00:06:47,150 355 | And when I do, there we go. 356 | 357 | 90 358 | 00:06:47,180 --> 00:06:51,770 359 | If I try again, we try after four seconds, try again. 360 | 361 | 91 362 | 00:06:52,520 --> 00:06:57,260 363 | And if I keep on doing that, you see that that value keeps on changing relative to the number of seconds 364 | 365 | 92 366 | 00:06:57,260 --> 00:06:59,700 367 | that I have based on the last request. 368 | 369 | 93 370 | 00:06:59,720 --> 00:07:05,630 371 | So that is all we can add throttling and it automatically once again gives about that for twenty nine 372 | 373 | 94 374 | 00:07:05,630 --> 00:07:07,320 375 | to say too many requests. 376 | 377 | 95 378 | 00:07:07,880 --> 00:07:08,390 379 | All right. 380 | 381 | 96 382 | 00:07:08,660 --> 00:07:14,950 383 | And so the client knows that, hey, you're bombarding the API, enhance your comm. 384 | -------------------------------------------------------------------------------- /1. Install Visual Studio 2019 Community Edition and .Net 5 SDK.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,930 --> 00:00:06,360 3 | Hey, guys, today we're going to get started with installing Visual Studio, Community Edition and 4 | 5 | 2 6 | 00:00:06,360 --> 00:00:07,390 7 | DOT at five. 8 | 9 | 3 10 | 00:00:07,680 --> 00:00:12,240 11 | Now our journey begins here on the Visual Studio website, which you can get to see through a simple 12 | 13 | 4 14 | 00:00:12,240 --> 00:00:12,960 15 | Google search. 16 | 17 | 5 18 | 00:00:13,260 --> 00:00:20,240 19 | Or you can try to reproduce this URL, which is Visual Studio, dot Microsoft, dot com slash, VSS 20 | 21 | 6 22 | 00:00:20,250 --> 00:00:21,490 23 | slash community. 24 | 25 | 7 26 | 00:00:21,890 --> 00:00:28,290 27 | Now there are different editions of Visual Studio and community is the one that is free for individual 28 | 29 | 8 30 | 00:00:28,290 --> 00:00:30,360 31 | use and that's the one that we will use. 32 | 33 | 9 34 | 00:00:30,690 --> 00:00:35,940 35 | So you can go ahead and download Visual Studio, which will give you the visual studio installer. 36 | 37 | 10 38 | 00:00:36,600 --> 00:00:41,910 39 | And once that is completed, you can go ahead and run that file, go through in the security check points 40 | 41 | 11 42 | 00:00:41,910 --> 00:00:46,500 43 | that you might have, but you may proceed to allow the installer to begin. 44 | 45 | 12 46 | 00:00:46,770 --> 00:00:51,580 47 | Now, this is where you actually define what Visual Studio will be capable of. 48 | 49 | 13 50 | 00:00:51,600 --> 00:00:53,430 51 | So these are called workload's. 52 | 53 | 14 54 | 00:00:53,700 --> 00:00:59,010 55 | And each workload will expose a different feature set to do so for Web development. 56 | 57 | 15 58 | 00:00:59,020 --> 00:01:04,290 59 | You want to get the speed on it and web development workload for desktop development. 60 | 61 | 16 62 | 00:01:04,290 --> 00:01:06,960 63 | You want to get the desktop development workload. 64 | 65 | 17 66 | 00:01:07,230 --> 00:01:14,040 67 | And for any other SDK or type of project that you may want to develop, you can go ahead and get the 68 | 69 | 18 70 | 00:01:14,040 --> 00:01:16,400 71 | workload associated with it. 72 | 73 | 19 74 | 00:01:17,010 --> 00:01:18,480 75 | For this exercise. 76 | 77 | 20 78 | 00:01:18,480 --> 00:01:23,430 79 | You want to prepare our visual studio with the necessary resources for web development. 80 | 81 | 21 82 | 00:01:24,120 --> 00:01:27,720 83 | Once again, you can go ahead and take as many of these workflows. 84 | 85 | 22 86 | 00:01:27,720 --> 00:01:33,150 87 | Each one will come with its own size and it tells you how much space is required based on the ones that 88 | 89 | 23 90 | 00:01:33,150 --> 00:01:33,920 91 | you select. 92 | 93 | 24 94 | 00:01:34,260 --> 00:01:39,660 95 | But at minimum, for Web development, you want to make sure you have speed on that and web development. 96 | 97 | 25 98 | 00:01:40,530 --> 00:01:44,580 99 | You can go ahead and take the other development tools if you wish. 100 | 101 | 26 102 | 00:01:44,580 --> 00:01:50,280 103 | But I'm not going to do that because these are all dot net framework six and four and four point eight 104 | 105 | 27 106 | 00:01:50,280 --> 00:01:52,980 107 | four point sixty four point seven and four point eight. 108 | 109 | 28 110 | 00:01:53,220 --> 00:01:59,220 111 | But we're going to be installing dot net five in a few minutes so you can go ahead and do this and let 112 | 113 | 29 114 | 00:01:59,220 --> 00:02:00,780 115 | Visual Studio install. 116 | 117 | 30 118 | 00:02:01,080 --> 00:02:04,890 119 | This will take a while so you can grab a cup of coffee and come back. 120 | 121 | 31 122 | 00:02:05,640 --> 00:02:08,990 123 | No ones that don't load and installation is completed. 124 | 125 | 32 126 | 00:02:09,000 --> 00:02:09,900 127 | You have two options. 128 | 129 | 33 130 | 00:02:09,900 --> 00:02:16,410 131 | You can go ahead and sign in and sign in, meaning you sign in with your life account if you have one. 132 | 133 | 34 134 | 00:02:16,410 --> 00:02:18,180 135 | If not, then you go ahead and create one. 136 | 137 | 35 138 | 00:02:18,360 --> 00:02:23,130 139 | It's free and it makes life easier if you just create one and actually sign in. 140 | 141 | 36 142 | 00:02:23,520 --> 00:02:29,580 143 | But I'll just go ahead with the not no maybe later option and then you choose your general settings. 144 | 145 | 37 146 | 00:02:29,580 --> 00:02:35,430 147 | So I like the dark theme and you can choose who they want web development settings or general, I'll 148 | 149 | 38 150 | 00:02:35,430 --> 00:02:38,400 151 | just leave mine on General even though we are doing web development. 152 | 153 | 39 154 | 00:02:38,700 --> 00:02:45,270 155 | But they basically just optimized certain keyboard shortcuts and the layout based on your selection 156 | 157 | 40 158 | 00:02:45,300 --> 00:02:46,620 159 | of Lieberman in general. 160 | 161 | 41 162 | 00:02:47,520 --> 00:02:49,500 163 | And I'll start with Visual Studio. 164 | 165 | 42 166 | 00:02:50,490 --> 00:02:50,970 167 | All right. 168 | 169 | 43 170 | 00:02:50,980 --> 00:02:55,520 171 | So once that is done, you're going to be prompted with this, though. 172 | 173 | 44 174 | 00:02:55,530 --> 00:02:57,150 175 | If you don't get this, then that's fine. 176 | 177 | 45 178 | 00:02:57,150 --> 00:03:04,650 179 | But here is why I would have suggested that you sign in with your life accounts because you you have 180 | 181 | 46 182 | 00:03:04,650 --> 00:03:06,900 183 | a 30 day trial period. 184 | 185 | 47 186 | 00:03:07,200 --> 00:03:10,950 187 | And if you don't have the account, then they'll basically just tell you to exit. 188 | 189 | 48 190 | 00:03:10,960 --> 00:03:13,220 191 | So you can actually just go ahead and sign in. 192 | 193 | 49 194 | 00:03:13,230 --> 00:03:14,660 195 | So I'm just going to sign in with my own. 196 | 197 | 50 198 | 00:03:15,300 --> 00:03:21,570 199 | And once you have signed it and then you'll see that it is not licensed to you and it just looks a bit 200 | 201 | 51 202 | 00:03:21,570 --> 00:03:22,350 203 | more inviting. 204 | 205 | 52 206 | 00:03:22,380 --> 00:03:25,170 207 | So now, instead of exiting Visual Studio, I can close. 208 | 209 | 53 210 | 00:03:25,410 --> 00:03:29,610 211 | And this is Visual Studio at the very basic level. 212 | 213 | 54 214 | 00:03:29,880 --> 00:03:31,440 215 | Now we have Visual Studio. 216 | 217 | 55 218 | 00:03:31,440 --> 00:03:38,190 219 | What we also need is Daughton at five so you can get to the dot net five download page through a simple 220 | 221 | 56 222 | 00:03:38,190 --> 00:03:39,660 223 | Google search once again. 224 | 225 | 57 226 | 00:03:39,990 --> 00:03:42,240 227 | Or you try to reproduce this. 228 | 229 | 58 230 | 00:03:42,240 --> 00:03:45,470 231 | You are whichever one you find easier to do at this point. 232 | 233 | 59 234 | 00:03:45,490 --> 00:03:49,080 235 | You want to download the SDK and the runtime. 236 | 237 | 60 238 | 00:03:49,080 --> 00:03:55,800 239 | So let me start by closing Visual Studio because it need to install extensions for it and the installer 240 | 241 | 61 242 | 00:03:55,830 --> 00:03:57,500 243 | is always available for you. 244 | 245 | 62 246 | 00:03:57,510 --> 00:04:04,140 247 | So if you fail to add a workload, just so you know, you can actually just click modify and then it 248 | 249 | 63 250 | 00:04:04,140 --> 00:04:06,690 251 | will relaunch that page with all the workload. 252 | 253 | 64 254 | 00:04:06,700 --> 00:04:12,090 255 | So if later on you wanted to do something new, you just need to modify, get that workload and then 256 | 257 | 65 258 | 00:04:12,090 --> 00:04:14,480 259 | you will get those project templates accordingly. 260 | 261 | 66 262 | 00:04:15,450 --> 00:04:20,010 263 | I'm going to close with the studio, however, so we can continue with our installation, so we'll get 264 | 265 | 67 266 | 00:04:20,010 --> 00:04:21,110 267 | the dominant five. 268 | 269 | 68 270 | 00:04:21,420 --> 00:04:24,990 271 | No, you can see that the SDK is available based on your OS. 272 | 273 | 69 274 | 00:04:24,990 --> 00:04:32,280 275 | I have Windows 64 bit OS working with right now, so I'll go ahead and download that and why that one 276 | 277 | 70 278 | 00:04:32,280 --> 00:04:32,940 279 | is downloading. 280 | 281 | 71 282 | 00:04:32,950 --> 00:04:40,650 283 | I'm just going to hit the mark button and go over to the runtime, which is absolutely necessary for 284 | 285 | 72 286 | 00:04:40,650 --> 00:04:43,740 287 | hosting to see the ICE runtime support. 288 | 289 | 73 290 | 00:04:44,010 --> 00:04:50,970 291 | So if you're going to be hosting the net five application on a local server, then you definitely need 292 | 293 | 74 294 | 00:04:51,150 --> 00:04:56,220 295 | the runtime so you can just get this hosting bundle that they have there available for download. 296 | 297 | 75 298 | 00:04:56,430 --> 00:04:59,850 299 | So you can just download both and when they're both finished. 300 | 301 | 76 302 | 00:05:00,630 --> 00:05:04,530 303 | So when the SDK is finished, you can go ahead and install that one first. 304 | 305 | 77 306 | 00:05:04,530 --> 00:05:06,300 307 | It shouldn't take too long. 308 | 309 | 78 310 | 00:05:07,200 --> 00:05:14,310 311 | And OK, so it's successful after we've installed the SDK, then we want to just make sure that we have 312 | 313 | 79 314 | 00:05:14,310 --> 00:05:21,390 315 | the runtime also agree to anything and go ahead and ruin your installation and it will let you know 316 | 317 | 80 318 | 00:05:21,390 --> 00:05:26,820 319 | when it is successfully completed now that we have the SDK is completely installed. 320 | 321 | 81 322 | 00:05:27,000 --> 00:05:32,220 323 | I just want to launch Visual Studio and show you what you get with those SDK. 324 | 325 | 82 326 | 00:05:32,250 --> 00:05:35,550 327 | So if I go ahead and create a brand new project. 328 | 329 | 83 330 | 00:05:36,580 --> 00:05:41,740 331 | Because of the workload's that I have available to me, I will see different project templates, so 332 | 333 | 84 334 | 00:05:41,740 --> 00:05:47,980 335 | I own the tool is the Web workload, so I have the ability to do a regular console up. 336 | 337 | 85 338 | 00:05:48,170 --> 00:05:50,320 339 | I have the speed on it core. 340 | 341 | 86 342 | 00:05:50,590 --> 00:05:55,200 343 | As a matter of fact, I think that this one comes because of the desktop work load. 344 | 345 | 87 346 | 00:05:55,210 --> 00:05:59,030 347 | But at this point I'm not trying to figure out which workload belongs to which. 348 | 349 | 88 350 | 00:05:59,030 --> 00:06:04,990 351 | I just know that if you are going to be doing a Web project, you have the option to choose your Web 352 | 353 | 89 354 | 00:06:04,990 --> 00:06:13,240 355 | application, a blazer application, and you can choose them with a core or dot net framework, someone 356 | 357 | 90 358 | 00:06:13,240 --> 00:06:15,640 359 | to choose a core Web application. 360 | 361 | 91 362 | 00:06:16,150 --> 00:06:18,140 363 | This is not the actual application that we're building. 364 | 365 | 92 366 | 00:06:18,160 --> 00:06:22,540 367 | I'm just showing you your options when we go ahead, put the project name to create. 368 | 369 | 93 370 | 00:06:22,840 --> 00:06:28,240 371 | Then from the dropdown list here, you can choose whether you want to core two point one or three point 372 | 373 | 94 374 | 00:06:28,240 --> 00:06:35,650 375 | one or the latest dot Natcore five point or and with that, you will be able to choose the different 376 | 377 | 95 378 | 00:06:35,650 --> 00:06:36,950 379 | templates and proceed. 380 | 381 | 96 382 | 00:06:37,240 --> 00:06:44,620 383 | So when we come back, we'll actually create a project and do a tour of the folder structures. 384 | -------------------------------------------------------------------------------- /1. Create Microsoft Azure Account.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:01,260 --> 00:00:06,450 3 | Hey, guys, in this video will be creating or Microsoft as your accounts, like I said earlier, we 4 | 5 | 2 6 | 00:00:06,450 --> 00:00:09,890 7 | can get started for free to get to this website. 8 | 9 | 3 10 | 00:00:09,900 --> 00:00:13,690 11 | We go to Azor Dot Microsoft dot com. 12 | 13 | 4 14 | 00:00:13,710 --> 00:00:17,580 15 | And then I guess the road to according to your reason or your language. 16 | 17 | 5 18 | 00:00:18,030 --> 00:00:21,800 19 | But this is what the website looks or should look like. 20 | 21 | 6 22 | 00:00:22,110 --> 00:00:25,620 23 | And you can read through it to see exactly what Asgeir is all about. 24 | 25 | 7 26 | 00:00:25,810 --> 00:00:34,650 27 | It's about being futuristic, allowing more collaboration and operating more seamlessly in a cloud space 28 | 29 | 8 30 | 00:00:34,690 --> 00:00:40,660 31 | where there are all over the world and you usually would just choose the region that is closest to you. 32 | 33 | 9 34 | 00:00:40,680 --> 00:00:50,280 35 | So I'm actually in the Caribbean region, so my closest region is east to us or east us too. 36 | 37 | 10 38 | 00:00:50,640 --> 00:00:52,590 39 | But that's not for this video. 40 | 41 | 11 42 | 00:00:53,130 --> 00:00:53,700 43 | This video. 44 | 45 | 12 46 | 00:00:53,700 --> 00:00:55,110 47 | We're just creating the O'Collins. 48 | 49 | 13 50 | 00:00:55,110 --> 00:00:57,960 51 | We're not setting up anything about regions just yet. 52 | 53 | 14 54 | 00:00:58,730 --> 00:01:04,290 55 | So to get started, we can just well, if you have a live account already, then you can just go ahead 56 | 57 | 15 58 | 00:01:04,290 --> 00:01:08,010 59 | and send in with that live account where you can just click start free. 60 | 61 | 16 62 | 00:01:08,580 --> 00:01:14,460 63 | And here they tell you that you can create a free going to be and you can get started with 12 months 64 | 65 | 17 66 | 00:01:14,460 --> 00:01:15,460 67 | of free services. 68 | 69 | 18 70 | 00:01:15,480 --> 00:01:17,270 71 | So that's a good deal to me. 72 | 73 | 19 74 | 00:01:17,520 --> 00:01:23,430 75 | And if you scroll down, you'll see 12 months of free, popular free services, plus two hundred dollars 76 | 77 | 20 78 | 00:01:23,430 --> 00:01:26,110 79 | credits, which will expire in 30 days. 80 | 81 | 21 82 | 00:01:26,130 --> 00:01:32,880 83 | So they give it 200 dollars so you can create V virtual machines, you can create resources in the cloud 84 | 85 | 22 86 | 00:01:32,880 --> 00:01:35,070 87 | and experiment until that money is up. 88 | 89 | 23 90 | 00:01:35,400 --> 00:01:37,140 91 | And that's really just for one month. 92 | 93 | 24 94 | 00:01:37,140 --> 00:01:43,550 95 | But then there are certain services that you just get for free for the rest of the year and then you 96 | 97 | 25 98 | 00:01:43,590 --> 00:01:47,040 99 | have a few other services that are always free. 100 | 101 | 26 102 | 00:01:48,060 --> 00:01:52,140 103 | So what we're going to do is just go ahead and click, start free. 104 | 105 | 27 106 | 00:01:53,570 --> 00:01:57,260 107 | And then they'll ask us to sign in with our live accounts. 108 | 109 | 28 110 | 00:01:57,290 --> 00:02:00,170 111 | If you have a live account once again, you can go ahead and use that. 112 | 113 | 29 114 | 00:02:00,380 --> 00:02:03,340 115 | If you don't have an account, then you can go ahead and create one. 116 | 117 | 30 118 | 00:02:03,530 --> 00:02:09,280 119 | And this is a very recent option to sign in with GitHub. 120 | 121 | 31 122 | 00:02:09,710 --> 00:02:15,970 123 | So I have a live account that I use, but I'm just going to walk you through the create one first. 124 | 125 | 32 126 | 00:02:16,730 --> 00:02:21,230 127 | No, the Levaquin doesn't necessarily have to be at livor at all. 128 | 129 | 33 130 | 00:02:21,920 --> 00:02:25,340 131 | It doesn't have to be a traditional Hotmail account. 132 | 133 | 34 134 | 00:02:25,340 --> 00:02:26,780 135 | It can be a Gmail account. 136 | 137 | 35 138 | 00:02:26,780 --> 00:02:33,800 139 | So I can actually use maybe the same email address I used for getable or email addresses I use when 140 | 141 | 36 142 | 00:02:33,800 --> 00:02:38,930 143 | I'm signing up for things I can use that, whether it's Yahoo, Gmail, Hotmail or whatever it is, 144 | 145 | 37 146 | 00:02:39,200 --> 00:02:40,370 147 | and just click next. 148 | 149 | 38 150 | 00:02:41,180 --> 00:02:45,200 151 | And here it's it's telling me that I already have a Microsoft icon. 152 | 153 | 39 154 | 00:02:45,200 --> 00:02:46,430 155 | So that's just driving. 156 | 157 | 40 158 | 00:02:46,430 --> 00:02:53,720 159 | My point, though, that once you have an account, an email address, it doesn't have to be a hot meal 160 | 161 | 41 162 | 00:02:53,720 --> 00:03:00,260 163 | or a traditional Levaquin, but they are just creating a Microsoft account for you with that email address 164 | 165 | 42 166 | 00:03:00,500 --> 00:03:03,550 167 | so you can go ahead and sign up. 168 | 169 | 43 170 | 00:03:03,710 --> 00:03:06,050 171 | It's a pretty straightforward process. 172 | 173 | 44 174 | 00:03:06,920 --> 00:03:08,930 175 | The account that they said already existed. 176 | 177 | 45 178 | 00:03:08,930 --> 00:03:12,740 179 | That's an account I was using to sign up for the free account. 180 | 181 | 46 182 | 00:03:12,750 --> 00:03:15,530 183 | So I actually just went ahead and logged in. 184 | 185 | 47 186 | 00:03:15,530 --> 00:03:21,380 187 | And because I really didn't setup much more, I think that your registration process is actually going 188 | 189 | 48 190 | 00:03:21,380 --> 00:03:24,410 191 | to look very similar to this regardless. 192 | 193 | 49 194 | 00:03:24,420 --> 00:03:29,500 195 | So on to get over the hurdle of putting in your email address and proceeding, then you're probably 196 | 197 | 50 198 | 00:03:29,510 --> 00:03:36,380 199 | going to end up on a screen like this where you're going to be asked for your demographic information. 200 | 201 | 51 202 | 00:03:36,380 --> 00:03:43,670 203 | Just for the record, keeping my country and region is Jamaica and I'm putting in my phone number that 204 | 205 | 52 206 | 00:03:43,670 --> 00:03:44,450 207 | I treat next. 208 | 209 | 53 210 | 00:03:44,690 --> 00:03:52,640 211 | And then they say, do you want to verify your identity by phone or do you want to buy a card or someone 212 | 213 | 54 214 | 00:03:52,640 --> 00:03:53,420 215 | to choose? 216 | 217 | 55 218 | 00:03:53,420 --> 00:03:57,710 219 | Takes me by phone and I just got the text. 220 | 221 | 56 222 | 00:03:57,710 --> 00:03:59,210 223 | It didn't take long at all. 224 | 225 | 57 226 | 00:03:59,210 --> 00:04:03,410 227 | So I'm just going to put in the code and then verify. 228 | 229 | 58 230 | 00:04:05,210 --> 00:04:09,560 231 | Now, here's the part that might deter you if you're not prepared for it. 232 | 233 | 59 234 | 00:04:09,590 --> 00:04:15,770 235 | They will want to verify your identity by card so you won't be charged unless you upgrade, meaning 236 | 237 | 60 238 | 00:04:15,920 --> 00:04:18,320 239 | they have different OILCLOTH subscription plans. 240 | 241 | 61 242 | 00:04:18,320 --> 00:04:21,320 243 | So you're signing up for the free subscription plan. 244 | 245 | 62 246 | 00:04:21,350 --> 00:04:29,300 247 | Once that free subscription plan is done, then you won't be able to do much on the platform until you 248 | 249 | 63 250 | 00:04:29,300 --> 00:04:32,690 251 | sign up for a new subscription plan which coincides that upgrade. 252 | 253 | 64 254 | 00:04:32,720 --> 00:04:40,610 255 | So like I said earlier, there is pay as you go and then there's pay as you go test, which is the one 256 | 257 | 65 258 | 00:04:40,610 --> 00:04:44,240 259 | item on which is like half the price of the regular pay as you go. 260 | 261 | 66 262 | 00:04:44,990 --> 00:04:48,590 263 | So I actually provided my card information when I signed up. 264 | 265 | 67 266 | 00:04:48,920 --> 00:04:52,760 267 | And having done that, you can make an agreement. 268 | 269 | 68 270 | 00:04:52,760 --> 00:04:57,950 271 | If you don't have a card or you're not comfortable with providing your card details, then I mean, 272 | 273 | 69 274 | 00:04:58,010 --> 00:04:59,000 275 | you can stop here. 276 | 277 | 70 278 | 00:04:59,010 --> 00:04:59,710 279 | That's fine. 280 | 281 | 71 282 | 00:05:00,350 --> 00:05:05,390 283 | Later on, when we're actually deploying to as you can still see what it will look like and see how 284 | 285 | 72 286 | 00:05:05,390 --> 00:05:06,650 287 | beneficial it is to you. 288 | 289 | 73 290 | 00:05:07,760 --> 00:05:13,730 291 | But if you wish, then you can go ahead and provide your information and then click on the agreement 292 | 293 | 74 294 | 00:05:13,730 --> 00:05:18,800 295 | and accept the agreement terms and then you would be in on the platform. 296 | 297 | 75 298 | 00:05:18,800 --> 00:05:25,010 299 | So I'm just going to sign into my real account, my quote unquote relection, the one that I use, and 300 | 301 | 76 302 | 00:05:25,010 --> 00:05:26,450 303 | show you what a zero looks like. 304 | 305 | 77 306 | 00:05:27,840 --> 00:05:33,660 307 | Well, actually, I just stepped in portable dot as dot com, hoping that you would ask me to log in, 308 | 309 | 78 310 | 00:05:33,660 --> 00:05:39,510 311 | but I did that and they just rewrote me using the same icon that I was just setting up toward Williams 312 | 313 | 79 314 | 00:05:39,510 --> 00:05:40,680 315 | at G.M. dot com. 316 | 317 | 80 318 | 00:05:40,920 --> 00:05:43,290 319 | So this dashboard. 320 | 321 | 81 322 | 00:05:43,300 --> 00:05:45,330 323 | So this is the Azura dashboard. 324 | 325 | 82 326 | 00:05:45,500 --> 00:05:46,740 327 | That's a very basic level. 328 | 329 | 83 330 | 00:05:46,740 --> 00:05:52,350 331 | They have a panel to the side here listing out quite a few services that you can get. 332 | 333 | 84 334 | 00:05:52,650 --> 00:05:57,750 335 | But then because we didn't complete this little boy, because I didn't complete the setup, at least 336 | 337 | 85 338 | 00:05:57,750 --> 00:06:02,280 339 | then when I go to subscriptions, I'm going to see that I have no subscription. 340 | 341 | 86 342 | 00:06:02,710 --> 00:06:08,840 343 | So like I will see in the subscription is how they treat you as a customer, whether Europe as you go 344 | 345 | 87 346 | 00:06:08,850 --> 00:06:10,660 347 | enterprise or whatever. 348 | 349 | 88 350 | 00:06:10,680 --> 00:06:18,360 351 | So if I later on decide that I want to provide my information, I can just come back and click add and 352 | 353 | 89 354 | 00:06:18,360 --> 00:06:25,380 355 | then that will bring me to complete the Senate procedure where I actually add the subscription. 356 | 357 | 90 358 | 00:06:25,410 --> 00:06:27,990 359 | So this is a free trial, one that we're setting up just now. 360 | 361 | 91 362 | 00:06:28,710 --> 00:06:29,420 363 | As you go. 364 | 365 | 92 366 | 00:06:29,580 --> 00:06:33,390 367 | You have developer support as you have quite a few of them. 368 | 369 | 93 370 | 00:06:33,460 --> 00:06:33,790 371 | All right. 372 | 373 | 94 374 | 00:06:34,110 --> 00:06:41,090 375 | So I would probably go with pay as you go, but that that's yeah. 376 | 377 | 95 378 | 00:06:41,130 --> 00:06:49,380 379 | This is all in the in the steps of signing up for Azor, and that is if you wish to proceed with that. 380 | 381 | 96 382 | 00:06:50,280 --> 00:06:56,010 383 | But then for this detour, really and truly, I just wanted you to get as far as the dashboard so that 384 | 385 | 97 386 | 00:06:56,010 --> 00:06:58,950 387 | you can see that this is what a zero looks like. 388 | 389 | 98 390 | 00:06:59,220 --> 00:07:03,750 391 | This is really workload management, portelli against against your virtual machines. 392 | 393 | 99 394 | 00:07:03,990 --> 00:07:09,060 395 | But for this course, we'll be looking at up services. 396 | -------------------------------------------------------------------------------- /1. Create and Tour Web API Project.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,730 --> 00:00:01,690 3 | Hey, guys, welcome back. 4 | 5 | 2 6 | 00:00:01,720 --> 00:00:05,860 7 | So the first thing that we need to do, having set up our environment and everything, is to create 8 | 9 | 3 10 | 00:00:05,860 --> 00:00:06,600 11 | our projects. 12 | 13 | 4 14 | 00:00:06,600 --> 00:00:12,310 15 | So what we're going to do is launch Visual Studio and then we are going to go to create a new project. 16 | 17 | 5 18 | 00:00:12,970 --> 00:00:13,540 19 | From here. 20 | 21 | 6 22 | 00:00:13,550 --> 00:00:19,840 23 | You can choose the template that you want if you have HSP, not Natcore Web application at the top. 24 | 25 | 7 26 | 00:00:19,870 --> 00:00:20,920 27 | Go ahead and select it. 28 | 29 | 8 30 | 00:00:20,920 --> 00:00:25,440 31 | If you don't, then you can just type in web in this filter and it will filter down. 32 | 33 | 9 34 | 00:00:25,750 --> 00:00:32,530 35 | We're going to be using C sharp, so make sure that C Sharp is selected and you don't have to change 36 | 37 | 10 38 | 00:00:32,530 --> 00:00:36,990 39 | much else but to select the desired templates and go ahead and click next. 40 | 41 | 11 42 | 00:00:37,480 --> 00:00:42,750 43 | No will be building a hotel listing API. 44 | 45 | 12 46 | 00:00:43,030 --> 00:00:51,610 47 | So I'm going to call my project hotel listing right now that we have that we don't have to change much 48 | 49 | 13 50 | 00:00:51,610 --> 00:00:53,380 51 | else we can go ahead and create. 52 | 53 | 14 54 | 00:00:53,380 --> 00:00:57,040 55 | If you want to select a specific location, you may go ahead and do that. 56 | 57 | 15 58 | 00:00:57,340 --> 00:01:04,550 59 | Otherwise, proceed with create next step has a selecting the stock that we intend to use. 60 | 61 | 16 62 | 00:01:04,900 --> 00:01:10,360 63 | No, you would have already installed the dot net five SDK and Visual Studio twenty nineteen. 64 | 65 | 17 66 | 00:01:10,630 --> 00:01:16,810 67 | So you should have gotten it core 5.0 as a as an option. 68 | 69 | 18 70 | 00:01:17,230 --> 00:01:20,200 71 | If you don't have this then you should have three point one. 72 | 73 | 19 74 | 00:01:20,470 --> 00:01:26,800 75 | Either way you can just double back, go ahead and install the SDK, review that video if you need to 76 | 77 | 20 78 | 00:01:26,800 --> 00:01:33,940 79 | make sure you have everything installed and then you can go ahead and select 5.0 and we will be building 80 | 81 | 21 82 | 00:01:33,940 --> 00:01:36,490 83 | and speed on that core Web API. 84 | 85 | 22 86 | 00:01:36,970 --> 00:01:44,110 87 | No, to the right, we have the option of adding authentication and configuring some other things. 88 | 89 | 23 90 | 00:01:44,110 --> 00:01:46,050 91 | So we'll leave everything as is. 92 | 93 | 24 94 | 00:01:46,420 --> 00:01:53,770 95 | We won't be configuring the authentication here because the options that are given to us are not really 96 | 97 | 25 98 | 00:01:53,770 --> 00:01:54,370 99 | what we want. 100 | 101 | 26 102 | 00:01:54,370 --> 00:01:57,850 103 | So we'll be manually configuring that later on. 104 | 105 | 27 106 | 00:01:57,850 --> 00:01:59,370 107 | And that would be a good exercise. 108 | 109 | 28 110 | 00:01:59,470 --> 00:02:06,130 111 | At least I hope you understand how identity card gets integrated into your API, but we can leave it 112 | 113 | 29 114 | 00:02:06,130 --> 00:02:10,400 115 | as no authentication right now and then we can go ahead and click create. 116 | 117 | 30 118 | 00:02:11,350 --> 00:02:15,890 119 | So now that's our project has been created the just 2.0. 120 | 121 | 31 122 | 00:02:15,910 --> 00:02:21,460 123 | Before I move much further, the layout of my visual studio may look different from yours because I 124 | 125 | 32 126 | 00:02:21,460 --> 00:02:25,420 127 | tend to use the solution explorer on my left hand side. 128 | 129 | 33 130 | 00:02:25,900 --> 00:02:28,930 131 | By default, it should be on the right or it would be on the right. 132 | 133 | 34 134 | 00:02:28,930 --> 00:02:30,670 135 | So that's probably what yours looks like. 136 | 137 | 35 138 | 00:02:30,670 --> 00:02:34,210 139 | Either way, you can always drag it and put it wherever you want. 140 | 141 | 36 142 | 00:02:34,550 --> 00:02:36,340 143 | I like to have it to the left. 144 | 145 | 37 146 | 00:02:36,340 --> 00:02:38,580 147 | So that's where I'll be using my No. 148 | 149 | 38 150 | 00:02:38,590 --> 00:02:43,060 151 | The solution explorer is giving us a list of files and I'm just going through this and this is the first 152 | 153 | 39 154 | 00:02:43,060 --> 00:02:44,950 155 | time creating a project. 156 | 157 | 40 158 | 00:02:45,250 --> 00:02:50,140 159 | If it's not, then I'll just go over this anyway, because, you know, repetition, Beaton's impression 160 | 161 | 41 162 | 00:02:50,410 --> 00:02:53,200 163 | and maybe I'll point out something that you didn't know before. 164 | 165 | 42 166 | 00:02:53,200 --> 00:02:59,200 167 | But hey, so the first thing that we want to look at is our properties folder. 168 | 169 | 43 170 | 00:02:59,200 --> 00:03:01,480 171 | So let me start over. 172 | 173 | 44 174 | 00:03:01,480 --> 00:03:07,570 175 | So we have what we call the solution, which is like a manifest for the list of projects that are in 176 | 177 | 45 178 | 00:03:07,570 --> 00:03:09,310 179 | this solution that we're building. 180 | 181 | 46 182 | 00:03:10,000 --> 00:03:12,700 183 | The project is hotel listing. 184 | 185 | 47 186 | 00:03:12,700 --> 00:03:18,760 187 | I notice when I click it, it's really just an example file with a bunch of configurations and listings 188 | 189 | 48 190 | 00:03:19,060 --> 00:03:23,890 191 | and other things needed for the project to know what its identity is. 192 | 193 | 49 194 | 00:03:23,890 --> 00:03:27,880 195 | So because it is that net 5.0, you see that's the target framework. 196 | 197 | 50 198 | 00:03:28,180 --> 00:03:35,020 199 | If we choose three point one, we would see something different there on the properties or other dependencies. 200 | 201 | 51 202 | 00:03:35,020 --> 00:03:38,530 203 | We see analysers, frameworks, packages as we go along. 204 | 205 | 52 206 | 00:03:38,530 --> 00:03:39,910 207 | You see this list growing. 208 | 209 | 53 210 | 00:03:39,910 --> 00:03:42,610 211 | So don't get too much into what's happening there. 212 | 213 | 54 214 | 00:03:43,090 --> 00:03:45,430 215 | We look at properties, we see the line settings. 216 | 217 | 55 218 | 00:03:45,430 --> 00:03:52,690 219 | So here it's like just configurations to tell the application how it should behave when we are in the 220 | 221 | 56 222 | 00:03:52,690 --> 00:03:53,260 223 | bug mode. 224 | 225 | 57 226 | 00:03:53,740 --> 00:04:02,080 227 | So what's very important here, though, is that we did allow it to configure SSL or TPS when we're 228 | 229 | 58 230 | 00:04:02,080 --> 00:04:02,980 231 | creating a project. 232 | 233 | 59 234 | 00:04:03,400 --> 00:04:06,040 235 | As a result, we have this SSL port. 236 | 237 | 60 238 | 00:04:06,430 --> 00:04:15,430 239 | So when we're doing our application, testing and so on will be at HTP s colon slash slash localhost 240 | 241 | 61 242 | 00:04:15,640 --> 00:04:16,300 243 | colon. 244 | 245 | 62 246 | 00:04:16,300 --> 00:04:25,420 247 | And then because ETPs, we're using the SSA report, otherwise this would be the less secure HTP endpoint. 248 | 249 | 63 250 | 00:04:25,510 --> 00:04:29,350 251 | So that's just a little thing that I'm pointing out. 252 | 253 | 64 254 | 00:04:29,350 --> 00:04:35,710 255 | Otherwise, the other configurations we'll get into as we go along, we have our controllers folder, 256 | 257 | 65 258 | 00:04:35,710 --> 00:04:42,400 259 | which really Hoess, our well controllers and these do exactly what the name suggests. 260 | 261 | 66 262 | 00:04:42,400 --> 00:04:49,240 263 | They control the application flow, the logic or everything goes, you know, when we receive our request 264 | 265 | 67 266 | 00:04:49,240 --> 00:04:57,160 267 | for information, how we interpret it, and all of those behaviors would get defined inside of our controllers. 268 | 269 | 68 270 | 00:04:57,490 --> 00:05:00,200 271 | These are the first line of defense once it hits a. 272 | 273 | 69 274 | 00:05:00,360 --> 00:05:06,120 275 | API endpoint, you're actually coming to controller and then it would say, okay, which endpoint was 276 | 277 | 70 278 | 00:05:06,120 --> 00:05:06,450 279 | hit? 280 | 281 | 71 282 | 00:05:06,660 --> 00:05:07,750 283 | What should I do? 284 | 285 | 72 286 | 00:05:08,070 --> 00:05:10,890 287 | And then it will return accordingly. 288 | 289 | 73 290 | 00:05:11,370 --> 00:05:14,520 291 | Once again, as we go on, you'll see that come to life. 292 | 293 | 74 294 | 00:05:16,210 --> 00:05:23,110 295 | All right, I'm going to skip ahead to our upsetting thought, Jason, which doesn't talk much, we'll 296 | 297 | 75 298 | 00:05:23,110 --> 00:05:25,080 299 | be modifying that as we go along, though. 300 | 301 | 76 302 | 00:05:25,120 --> 00:05:31,720 303 | But let me go on to the program that Sears, which is the starting point for our application. 304 | 305 | 77 306 | 00:05:31,720 --> 00:05:35,070 307 | So here you see it runs its main functions. 308 | 309 | 78 310 | 00:05:35,080 --> 00:05:41,470 311 | If you don't know the language or developed in a C sharp console applications, you notice that you 312 | 313 | 79 314 | 00:05:41,470 --> 00:05:50,710 315 | always start with mean least C++, C Sharp Java, all of those languages at least have a mean method. 316 | 317 | 80 318 | 00:05:50,710 --> 00:05:50,960 319 | Right. 320 | 321 | 81 322 | 00:05:51,280 --> 00:05:57,190 323 | So once we're running, our API is going to hit the mean and in many is going to basically do like a 324 | 325 | 82 326 | 00:05:57,190 --> 00:05:57,930 327 | building. 328 | 329 | 83 330 | 00:05:57,940 --> 00:06:05,530 331 | So what it does is it aggregates all of the middleware on functionality and puts into the application. 332 | 333 | 84 334 | 00:06:05,830 --> 00:06:13,270 335 | So it goes this method, which is really defined right below, and it does its initialization based 336 | 337 | 85 338 | 00:06:13,270 --> 00:06:15,820 339 | on what is in our Start-Up File. 340 | 341 | 86 342 | 00:06:16,210 --> 00:06:22,900 343 | So if I go to startup, here's where you see where all the middle words are added and the configurations 344 | 345 | 87 346 | 00:06:22,900 --> 00:06:24,920 347 | are called at the get go. 348 | 349 | 88 350 | 00:06:25,750 --> 00:06:32,680 351 | So here we see where you want to use comptrollers to add whatever leverage we need to add so that we 352 | 353 | 89 354 | 00:06:32,680 --> 00:06:35,730 355 | can use our comptrollers setup swagger. 356 | 357 | 90 358 | 00:06:35,920 --> 00:06:43,510 359 | So traditionally, Swagga would have been you would have to implement that manually since this version 360 | 361 | 91 362 | 00:06:43,510 --> 00:06:45,910 363 | of Dunnett API, it comes out of the box. 364 | 365 | 92 366 | 00:06:45,920 --> 00:06:47,950 367 | So we don't have to do too much work. 368 | 369 | 93 370 | 00:06:47,950 --> 00:06:55,400 371 | But we'll be exploring what Swiger is later on in case you're not quite sure what it is we. 372 | 373 | 94 374 | 00:06:55,870 --> 00:06:58,510 375 | So that's configurations for your services. 376 | 377 | 95 378 | 00:06:58,510 --> 00:07:04,710 379 | So we have configure, which allows us to set up some other functionality. 380 | 381 | 96 382 | 00:07:04,720 --> 00:07:08,280 383 | So without getting too much into them, some of them are self-explanatory. 384 | 385 | 97 386 | 00:07:08,290 --> 00:07:12,450 387 | Some of them are for security reasons, and some of them are really nice to haves. 388 | 389 | 98 390 | 00:07:12,670 --> 00:07:17,950 391 | And we are going to be adding more and more as we put more features into our API. 392 | 393 | 99 394 | 00:07:17,950 --> 00:07:19,800 395 | So don't worry too much about it. 396 | 397 | 100 398 | 00:07:20,230 --> 00:07:24,890 399 | And the final file in this solution would just be this model. 400 | 401 | 101 402 | 00:07:24,910 --> 00:07:33,370 403 | So this model just basically represents data or a strongly typed unit of data, and we'll be defining 404 | 405 | 102 406 | 00:07:33,370 --> 00:07:37,750 407 | lots of models and data transfer objects later on. 408 | 409 | 103 410 | 00:07:38,170 --> 00:07:40,990 411 | But for now, we have created our project. 412 | 413 | 104 414 | 00:07:40,990 --> 00:07:46,330 415 | We should have a fair understanding of what we're looking at inside of this solution. 416 | 417 | 105 418 | 00:07:46,630 --> 00:07:54,130 419 | And when we come back, we will start configuring our first added service in the form of login. 420 | -------------------------------------------------------------------------------- /8. Protecting Endpoints.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,490 --> 00:00:01,630 3 | All right, guys, welcome back. 4 | 5 | 2 6 | 00:00:01,660 --> 00:00:08,350 7 | So coming off the heels of setting up our authentication manager to issue generates and issue the tokens, 8 | 9 | 3 10 | 00:00:08,350 --> 00:00:14,680 11 | what we want to do is actually finish up our login endpoints to the tune where we actually validate 12 | 13 | 4 14 | 00:00:14,680 --> 00:00:21,190 15 | the token and allow our deny access to anybody passing in this token. 16 | 17 | 5 18 | 00:00:21,190 --> 00:00:21,400 19 | Right. 20 | 21 | 6 22 | 00:00:21,970 --> 00:00:29,920 23 | So the first thing that we want to do is inject our newly created office manager service so we know 24 | 25 | 7 26 | 00:00:29,920 --> 00:00:37,270 27 | how to do the injection or if they can just go ahead and hit pause and go ahead and complete this injection 28 | 29 | 8 30 | 00:00:37,270 --> 00:00:38,000 31 | operation. 32 | 33 | 9 34 | 00:00:38,710 --> 00:00:44,770 35 | So once you've added the new three lines, one for the private property, one into the constructor and 36 | 37 | 10 38 | 00:00:45,100 --> 00:00:49,660 39 | initialization, then we can go about creating or a log endpoint. 40 | 41 | 11 42 | 00:00:49,670 --> 00:00:52,620 43 | So you would have already commented on the login endpoint. 44 | 45 | 12 46 | 00:00:52,630 --> 00:00:58,810 47 | You can uncommented and I already have the revised version of it on screen, so let's just go through 48 | 49 | 13 50 | 00:00:58,810 --> 00:00:59,310 51 | it together. 52 | 53 | 14 54 | 00:00:59,320 --> 00:01:08,160 55 | So what we want to do is log on to validate our requested or the data coming in the detail. 56 | 57 | 15 58 | 00:01:08,500 --> 00:01:19,150 59 | Then I'm going to see if the off manager validate user, if not so easy to read this as equals for us 60 | 61 | 16 62 | 00:01:19,150 --> 00:01:20,470 63 | in case you need to see sharp. 64 | 65 | 17 66 | 00:01:20,800 --> 00:01:23,770 67 | If not, you just put the exclamation side. 68 | 69 | 18 70 | 00:01:23,800 --> 00:01:28,390 71 | So this means if it is not a valid user, then return on authorized because. 72 | 73 | 19 74 | 00:01:28,390 --> 00:01:33,100 75 | Well, if you tried to log in and you're not a valid user, then you're not authorized to go any further. 76 | 77 | 20 78 | 00:01:33,100 --> 00:01:33,380 79 | Right. 80 | 81 | 21 82 | 00:01:34,450 --> 00:01:42,460 83 | Otherwise we're going to return accepted our OK, whatever it is I'm saying accepted, accepted new 84 | 85 | 22 86 | 00:01:42,640 --> 00:01:48,280 87 | and a new object with with an expression called token. 88 | 89 | 23 90 | 00:01:48,490 --> 00:01:52,890 91 | And it will take the value of the token that is created. 92 | 93 | 24 94 | 00:01:52,900 --> 00:01:57,350 95 | So we see it on the score off manager, not create a token. 96 | 97 | 25 98 | 00:01:57,970 --> 00:02:03,790 99 | So remember that that's what we would have set up in our office manager just null create token goes 100 | 101 | 26 102 | 00:02:03,790 --> 00:02:10,000 103 | through, generates all of these bits and pieces of data and then returns the tokens. 104 | 105 | 27 106 | 00:02:10,000 --> 00:02:12,590 107 | So that's what that payload will have. 108 | 109 | 28 110 | 00:02:12,610 --> 00:02:15,150 111 | So on to go ahead and test that functionality. 112 | 113 | 29 114 | 00:02:15,520 --> 00:02:18,850 115 | So let's revisit our login endpoint. 116 | 117 | 30 118 | 00:02:18,850 --> 00:02:21,120 119 | I'm just going to use Soggier for this part of it. 120 | 121 | 31 122 | 00:02:21,130 --> 00:02:30,640 123 | So just try it out and put in a user that I know I created and is already registered and then I'm going 124 | 125 | 32 126 | 00:02:30,640 --> 00:02:31,900 127 | to click execute. 128 | 129 | 33 130 | 00:02:32,030 --> 00:02:33,090 131 | Let's see what happens. 132 | 133 | 34 134 | 00:02:33,820 --> 00:02:34,550 135 | All right. 136 | 137 | 35 138 | 00:02:34,570 --> 00:02:36,610 139 | And we're getting a token response. 140 | 141 | 36 142 | 00:02:36,910 --> 00:02:39,460 143 | So you see this big string. 144 | 145 | 37 146 | 00:02:39,850 --> 00:02:47,350 147 | So token, that's by virtue of the expression we put in the custom object and the value being passed 148 | 149 | 38 150 | 00:02:47,350 --> 00:02:49,510 151 | is the token that is here. 152 | 153 | 39 154 | 00:02:50,350 --> 00:02:55,690 155 | So if I if I take this token and go to our website to look at what's in tokens. 156 | 157 | 40 158 | 00:02:58,020 --> 00:03:04,980 159 | Based it then we'll see here that we have the algorithm, we have Trevor, for example, DOT, that's 160 | 161 | 41 162 | 00:03:04,980 --> 00:03:07,040 163 | the claim for the user. 164 | 165 | 42 166 | 00:03:07,200 --> 00:03:09,630 167 | We have the role right. 168 | 169 | 43 170 | 00:03:09,930 --> 00:03:12,890 171 | And we have the expiration time. 172 | 173 | 44 174 | 00:03:13,350 --> 00:03:18,790 175 | And if you hover, it will show you exactly the time from when it's issued and the issuer. 176 | 177 | 45 178 | 00:03:19,140 --> 00:03:19,640 179 | All right. 180 | 181 | 46 182 | 00:03:19,830 --> 00:03:23,010 183 | And then if you wanted to go as far as verifying the signature, we could do that. 184 | 185 | 47 186 | 00:03:23,010 --> 00:03:28,310 187 | But we already have the mechanism to do that internally, so we don't need to do that here. 188 | 189 | 48 190 | 00:03:28,740 --> 00:03:36,750 191 | So now what I want to do is experiment with actually preventing somebody access to our endpoint, someone 192 | 193 | 49 194 | 00:03:36,750 --> 00:03:42,090 195 | to use our hotel hotel controller for that exercise. 196 | 197 | 50 198 | 00:03:42,570 --> 00:03:48,480 199 | So let's say that the ability to get the list of hotels, everybody should be able to do that. 200 | 201 | 51 202 | 00:03:48,480 --> 00:03:53,120 203 | We should be able to call it without authenticating, which is what we have been doing up until now. 204 | 205 | 52 206 | 00:03:53,490 --> 00:04:03,200 207 | However, we want to add an authorized flag or annotation to the call to get to one hotel's details. 208 | 209 | 53 210 | 00:04:03,200 --> 00:04:11,700 211 | So we just put on authorized and actually you could extend the the annotation here for the HTP get and 212 | 213 | 54 214 | 00:04:11,700 --> 00:04:13,170 215 | add authorized right there. 216 | 217 | 55 218 | 00:04:13,630 --> 00:04:13,800 219 | Right. 220 | 221 | 56 222 | 00:04:13,890 --> 00:04:15,120 223 | So you could do it either way. 224 | 225 | 57 226 | 00:04:15,120 --> 00:04:17,540 227 | So if you have this one, you don't need this one. 228 | 229 | 58 230 | 00:04:17,970 --> 00:04:19,800 231 | Personally, I like to separate them. 232 | 233 | 59 234 | 00:04:20,220 --> 00:04:23,790 235 | So I have the HTP yet authorize. 236 | 237 | 60 238 | 00:04:23,910 --> 00:04:27,600 239 | I'd actually like to or prefer to put it at the top. 240 | 241 | 61 242 | 00:04:27,780 --> 00:04:31,640 243 | So as I see it, I know it's an authorized endpoint. 244 | 245 | 62 246 | 00:04:32,310 --> 00:04:32,670 247 | Right. 248 | 249 | 63 250 | 00:04:33,000 --> 00:04:38,280 251 | So what we want to do is test our call so this and the point. 252 | 253 | 64 254 | 00:04:38,760 --> 00:04:41,870 255 | Unauthorized and authorized. 256 | 257 | 65 258 | 00:04:42,090 --> 00:04:42,750 259 | So let's go. 260 | 261 | 66 262 | 00:04:44,170 --> 00:04:50,700 263 | And for this activity, I'm going to use Postman someone to firstly test the one that we haven't authorized 264 | 265 | 67 266 | 00:04:50,710 --> 00:04:52,570 267 | just to make sure that it still works. 268 | 269 | 68 270 | 00:04:52,870 --> 00:04:53,310 271 | All right. 272 | 273 | 69 274 | 00:04:53,320 --> 00:04:55,800 275 | There's a list of photos of three hotels. 276 | 277 | 70 278 | 00:04:55,810 --> 00:04:56,190 279 | Good. 280 | 281 | 71 282 | 00:04:56,620 --> 00:05:04,140 283 | Now I'm going to test the one with the endpoint that requires an ID value. 284 | 285 | 72 286 | 00:05:04,150 --> 00:05:04,480 287 | Right. 288 | 289 | 73 290 | 00:05:04,510 --> 00:05:11,770 291 | So when I click send, it's going to say for one unauthorized it's not saying for one unauthorized because 292 | 293 | 74 294 | 00:05:11,770 --> 00:05:19,210 295 | I didn't login or whatever, because I mean, this is already authorized and we set up the default schema 296 | 297 | 75 298 | 00:05:19,210 --> 00:05:24,430 299 | to see I need to see a token in order to authorize are not Soloff. 300 | 301 | 76 302 | 00:05:24,430 --> 00:05:26,470 303 | That's just happening automatically. 304 | 305 | 77 306 | 00:05:27,400 --> 00:05:34,000 307 | If we have an old token in there, which I do, this is a token that was issued more than 50 minutes 308 | 309 | 78 310 | 00:05:34,000 --> 00:05:39,560 311 | ago, then it will automatically also deny access. 312 | 313 | 79 314 | 00:05:39,580 --> 00:05:44,350 315 | So in a token is issued and then it expires. 316 | 317 | 80 318 | 00:05:44,590 --> 00:05:48,570 319 | It is the onus of the client calling up. 320 | 321 | 81 322 | 00:05:48,950 --> 00:05:54,850 323 | Applications are to go and fetch a new token, meaning go through the login process again, get a new 324 | 325 | 82 326 | 00:05:54,850 --> 00:05:59,080 327 | token, and then come back and try and access this endpoint. 328 | 329 | 83 330 | 00:05:59,920 --> 00:06:00,300 331 | All right. 332 | 333 | 84 334 | 00:06:00,670 --> 00:06:08,050 335 | So in Postman, what we want to do is go with the authorization and choose barer token from this dropdown 336 | 337 | 85 338 | 00:06:08,050 --> 00:06:08,410 339 | list. 340 | 341 | 86 342 | 00:06:08,620 --> 00:06:12,820 343 | Then we provide the token that we have, which is the first token. 344 | 345 | 87 346 | 00:06:13,060 --> 00:06:18,640 347 | And then when we do that and I'm still getting a four or one on authorized. 348 | 349 | 88 350 | 00:06:18,640 --> 00:06:23,750 351 | So that means there's some configuration that is missing. 352 | 353 | 89 354 | 00:06:23,830 --> 00:06:24,750 355 | Let me go. 356 | 357 | 90 358 | 00:06:24,910 --> 00:06:27,280 359 | More than likely to be the start of that series. 360 | 361 | 91 362 | 00:06:27,610 --> 00:06:32,640 363 | And I think I left off one of the middleware. 364 | 365 | 92 366 | 00:06:32,650 --> 00:06:37,650 367 | So I need to add up, not use authentication right here. 368 | 369 | 93 370 | 00:06:38,720 --> 00:06:39,240 371 | All right. 372 | 373 | 94 374 | 00:06:39,790 --> 00:06:44,710 375 | So make sure you have this user authentication and order Mutter's in this situation. 376 | 377 | 95 378 | 00:06:44,710 --> 00:06:51,760 379 | So authentication, then authorization and all of that before this are up, not MVC. 380 | 381 | 96 382 | 00:06:52,150 --> 00:06:57,300 383 | The different core versions of different middleware is being included. 384 | 385 | 97 386 | 00:06:57,310 --> 00:07:01,050 387 | So as long as you get that general theme, you should be good. 388 | 389 | 98 390 | 00:07:01,060 --> 00:07:03,460 391 | So let's try that same request again. 392 | 393 | 99 394 | 00:07:04,850 --> 00:07:07,280 395 | And we're having much better success. 396 | 397 | 100 398 | 00:07:07,490 --> 00:07:12,670 399 | All right, so we're getting a status 200, OK, and we're seeing the one quarter that we requested. 400 | 401 | 101 402 | 00:07:12,680 --> 00:07:19,460 403 | So now you see that we just protected our endpoint, because if I remove this sense or off and insurance 404 | 405 | 102 406 | 00:07:19,460 --> 00:07:25,850 407 | and again, I get to for one unauthorized once I include the beer all token, I get the status 200. 408 | 409 | 103 410 | 00:07:25,850 --> 00:07:33,050 411 | If I modify this beer token, then it's unauthorized because the token could not be validated against 412 | 413 | 104 414 | 00:07:33,050 --> 00:07:36,800 415 | the information that was encoded and put in originally. 416 | 417 | 105 418 | 00:07:37,100 --> 00:07:40,280 419 | So that is how you can go ahead and harden your API. 420 | 421 | 106 422 | 00:07:40,280 --> 00:07:48,830 423 | And once again, this just this JWT method is very secure because this payload, yes, it can be decoded, 424 | 425 | 107 426 | 00:07:48,830 --> 00:07:55,370 427 | but it wanted shouldn't contain any information that is too sensitive and information that it contains 428 | 429 | 108 430 | 00:07:55,370 --> 00:08:02,450 431 | should be information that if you see it, it's of no major consequence to the API and the underlying 432 | 433 | 109 434 | 00:08:02,450 --> 00:08:03,320 435 | infrastructure. 436 | 437 | 110 438 | 00:08:03,500 --> 00:08:09,980 439 | However, it is enough for me to verify who you are and that I am the one who gave you access to the 440 | 441 | 111 442 | 00:08:09,980 --> 00:08:10,460 443 | system. 444 | -------------------------------------------------------------------------------- /3. Construct GET By Id Endpoint.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:01,050 --> 00:00:08,010 3 | All right, so previously we configured our get to method, and this is really the get all method, 4 | 5 | 2 6 | 00:00:08,010 --> 00:00:11,790 7 | but it's not all the time that our client application wants to get everything. 8 | 9 | 3 10 | 00:00:12,120 --> 00:00:14,400 11 | Sometimes they want to get specific data. 12 | 13 | 4 14 | 00:00:14,600 --> 00:00:14,990 15 | All right. 16 | 17 | 5 18 | 00:00:15,000 --> 00:00:23,310 19 | So we want to at least provide them an endpoint where they can get one country based on a particular 20 | 21 | 6 22 | 00:00:23,730 --> 00:00:25,600 23 | unique identifier. 24 | 25 | 7 26 | 00:00:26,070 --> 00:00:27,600 27 | In this case, the ID. 28 | 29 | 8 30 | 00:00:28,030 --> 00:00:28,410 31 | Right. 32 | 33 | 9 34 | 00:00:28,770 --> 00:00:34,230 35 | And just for context, since we're building the API with the context of the actual client. 36 | 37 | 10 38 | 00:00:35,210 --> 00:00:42,080 39 | If you saw a list of countries and you wanted to see the details of one of these countries and you click 40 | 41 | 11 42 | 00:00:42,080 --> 00:00:47,660 43 | The View, then what would happen is that it would go back to the database and get that specific country 44 | 45 | 12 46 | 00:00:48,080 --> 00:00:52,490 47 | to display the specific information or details of that particular country. 48 | 49 | 13 50 | 00:00:53,000 --> 00:00:53,360 51 | All right. 52 | 53 | 14 54 | 00:00:53,540 --> 00:00:59,810 55 | So that's the same thing that we want to provide an endpoint for so that when on their side, when the 56 | 57 | 15 58 | 00:00:59,810 --> 00:01:02,690 59 | user clicks the country, they're in the background. 60 | 61 | 16 62 | 00:01:02,690 --> 00:01:05,950 63 | We'll see which country was tricked here, which IDs there. 64 | 65 | 17 66 | 00:01:06,200 --> 00:01:08,210 67 | Here's the ID API, please. 68 | 69 | 18 70 | 00:01:08,210 --> 00:01:09,410 71 | May I have the details? 72 | 73 | 19 74 | 00:01:09,410 --> 00:01:14,040 75 | And then we say, OK, we'll do the look up the details for that particular country. 76 | 77 | 20 78 | 00:01:14,570 --> 00:01:18,210 79 | So without any further delay, let's get to it. 80 | 81 | 21 82 | 00:01:18,410 --> 00:01:21,470 83 | So I'm actually just going to copy that original get. 84 | 85 | 22 86 | 00:01:22,340 --> 00:01:22,760 87 | All right. 88 | 89 | 23 90 | 00:01:23,120 --> 00:01:26,020 91 | And we're just going to make some minor modifications. 92 | 93 | 24 94 | 00:01:26,270 --> 00:01:30,050 95 | So the first modification would be to the attributes. 96 | 97 | 25 98 | 00:01:30,050 --> 00:01:32,060 99 | So, yes, they're both targets. 100 | 101 | 26 102 | 00:01:32,510 --> 00:01:32,930 103 | Right. 104 | 105 | 27 106 | 00:01:33,440 --> 00:01:40,150 107 | But this get in particular needs to know that it can take a parameter. 108 | 109 | 28 110 | 00:01:40,200 --> 00:01:40,600 111 | Right. 112 | 113 | 29 114 | 00:01:40,770 --> 00:01:45,050 115 | And this is really it has a lot to do with documentation purposes. 116 | 117 | 30 118 | 00:01:45,050 --> 00:01:53,090 119 | And it's good so that when people see it, they can infer at the same time what how it differs as it 120 | 121 | 31 122 | 00:01:53,090 --> 00:01:53,680 123 | goes along. 124 | 125 | 32 126 | 00:01:53,690 --> 00:01:57,680 127 | So you can define the gate, but then you open and close Breece. 128 | 129 | 33 130 | 00:01:57,920 --> 00:02:02,590 131 | And then inside of that you define the template for the gate. 132 | 133 | 34 134 | 00:02:02,600 --> 00:02:08,390 135 | So I can see here that I'm expecting some parameter called ID and it should be off of it. 136 | 137 | 35 138 | 00:02:08,850 --> 00:02:14,420 139 | So if you wanted to get by name, we could do something like name of type street. 140 | 141 | 36 142 | 00:02:14,960 --> 00:02:15,530 143 | All right. 144 | 145 | 37 146 | 00:02:15,950 --> 00:02:23,090 147 | So so you would know that this gate is going to take this parameter name and the names are very important 148 | 149 | 38 150 | 00:02:23,510 --> 00:02:26,570 151 | and that data type, which is also very important. 152 | 153 | 39 154 | 00:02:27,830 --> 00:02:30,380 155 | Next, we are going to have to rename this. 156 | 157 | 40 158 | 00:02:30,380 --> 00:02:31,780 159 | I mean, get countries. 160 | 161 | 41 162 | 00:02:31,820 --> 00:02:33,170 163 | This isn't getting countries. 164 | 165 | 42 166 | 00:02:33,170 --> 00:02:38,960 167 | This is getting a country and it is taking a parameter ID. 168 | 169 | 43 170 | 00:02:39,680 --> 00:02:43,850 171 | So like with any other method anywhere else in C sharp ones, they're calling them. 172 | 173 | 44 174 | 00:02:43,850 --> 00:02:48,950 175 | If that has now you have to pass a perimeter in, you have to define department that that's expecting. 176 | 177 | 45 178 | 00:02:49,220 --> 00:02:53,990 179 | I notice that the name here matches the name that is in the attributes. 180 | 181 | 46 182 | 00:02:54,470 --> 00:02:54,880 183 | All right. 184 | 185 | 47 186 | 00:02:55,370 --> 00:02:58,310 187 | So get country ID. 188 | 189 | 48 190 | 00:02:59,660 --> 00:03:05,810 191 | No, we have to see him try to catch, but then we're going to change the quarry and the mopping up. 192 | 193 | 49 194 | 00:03:06,020 --> 00:03:12,950 195 | So one, we're not getting countries, we're getting in country and we're all in the same elite units 196 | 197 | 50 198 | 00:03:12,950 --> 00:03:16,250 199 | of four countries, what we're calling the get method. 200 | 201 | 51 202 | 00:03:17,120 --> 00:03:17,600 203 | All right. 204 | 205 | 52 206 | 00:03:17,780 --> 00:03:26,930 207 | And our get method notice the red line, the get method requires the expression or the stipulation behind 208 | 209 | 53 210 | 00:03:26,930 --> 00:03:29,030 211 | what exactly it should be getting. 212 | 213 | 54 214 | 00:03:29,390 --> 00:03:32,870 215 | So we have to define in this the expressions. 216 | 217 | 55 218 | 00:03:32,870 --> 00:03:36,320 219 | I remember I said that the expression is really going to be a lambda expressions. 220 | 221 | 56 222 | 00:03:36,320 --> 00:03:43,100 223 | I'm going to pass in that same kind of lambda expression, which is a token lambda arrow, and then 224 | 225 | 57 226 | 00:03:43,100 --> 00:03:45,010 227 | what am I looking for to Dot? 228 | 229 | 58 230 | 00:03:45,260 --> 00:03:48,480 231 | And then I have all the fields off the table. 232 | 233 | 59 234 | 00:03:48,770 --> 00:03:51,780 235 | So this was designed for countries, right? 236 | 237 | 60 238 | 00:03:52,280 --> 00:03:56,750 239 | So what field in the countries tables should I be looking for? 240 | 241 | 61 242 | 00:03:56,960 --> 00:04:05,360 243 | I'm looking for the ID and my my condition is that the ID in the country is stable much as the ID coming 244 | 245 | 62 246 | 00:04:05,360 --> 00:04:06,350 247 | in through the parameter. 248 | 249 | 63 250 | 00:04:07,770 --> 00:04:13,800 251 | All right, and then in the same way, I can include because I'm just thinking about it, if you ask 252 | 253 | 64 254 | 00:04:13,800 --> 00:04:19,860 255 | me for the country within the context of this some other country, I figure that maybe you will want 256 | 257 | 65 258 | 00:04:19,860 --> 00:04:22,950 259 | to see all the hotels for that particular country. 260 | 261 | 66 262 | 00:04:22,960 --> 00:04:29,730 263 | So while looking at the list of countries, you only want to see maybe the list of countries. 264 | 265 | 67 266 | 00:04:29,950 --> 00:04:34,330 267 | However, when you look at one country, you probably want to see the hotel. 268 | 269 | 68 270 | 00:04:35,400 --> 00:04:36,870 271 | So are hotels. 272 | 273 | 69 274 | 00:04:36,880 --> 00:04:41,190 275 | So I want to say a new list somewhere to passing a new list of timestream. 276 | 277 | 70 278 | 00:04:42,790 --> 00:04:51,970 279 | And I'm going to add to it, so this is what we initialize our list and we can say that I want to include 280 | 281 | 71 282 | 00:04:52,090 --> 00:04:53,120 283 | your toes. 284 | 285 | 72 286 | 00:04:53,530 --> 00:05:00,370 287 | So once again, this is not going to go over to our units of work, is going to hit the living, find 288 | 289 | 73 290 | 00:05:00,370 --> 00:05:06,250 291 | the method, which is in the generic repository, and it's going to hit the gate. 292 | 293 | 74 294 | 00:05:06,280 --> 00:05:08,970 295 | So this is the expression, this is the includes. 296 | 297 | 75 298 | 00:05:09,340 --> 00:05:11,410 299 | So it gets all the records. 300 | 301 | 76 302 | 00:05:11,830 --> 00:05:18,540 303 | Then it says if there is and includes, go ahead and include whatever you need to include, include 304 | 305 | 77 306 | 00:05:18,580 --> 00:05:20,280 307 | the hotel's right. 308 | 309 | 78 310 | 00:05:20,470 --> 00:05:28,540 311 | And then we're going to look at Macquarie, take off the tracking and return the first our default record 312 | 313 | 79 314 | 00:05:28,540 --> 00:05:32,480 315 | that matches and default means just return if we can't find anything. 316 | 317 | 80 318 | 00:05:32,480 --> 00:05:35,650 319 | But the first record that matches this expression. 320 | 321 | 81 322 | 00:05:35,650 --> 00:05:40,780 323 | So the expression would be where you got it is equal to the added value. 324 | 325 | 82 326 | 00:05:41,140 --> 00:05:49,900 327 | It will do all of that computation and just return the one record to country with all of the hotels 328 | 329 | 83 330 | 00:05:50,410 --> 00:05:51,440 331 | that are available. 332 | 333 | 84 334 | 00:05:51,460 --> 00:05:57,820 335 | So I'm just going to double check with my domain just to make sure that the thing is called hotels, 336 | 337 | 85 338 | 00:05:57,820 --> 00:06:01,200 339 | because this has to match just the same way in the detail. 340 | 341 | 86 342 | 00:06:01,210 --> 00:06:02,470 343 | It has to be hotels. 344 | 345 | 87 346 | 00:06:02,740 --> 00:06:03,540 347 | All right. 348 | 349 | 88 350 | 00:06:04,090 --> 00:06:09,250 351 | So now that we've done that wiring up, I'm just going to change up my mapping. 352 | 353 | 89 354 | 00:06:09,250 --> 00:06:14,110 355 | So I'm getting back one country object, one object. 356 | 357 | 90 358 | 00:06:14,110 --> 00:06:16,020 359 | So I'm not going to come up to our list. 360 | 361 | 91 362 | 00:06:16,030 --> 00:06:18,660 363 | I'm just mapping to contribute to you. 364 | 365 | 92 366 | 00:06:18,940 --> 00:06:20,470 367 | So that's a one to one mapping. 368 | 369 | 93 370 | 00:06:21,670 --> 00:06:29,550 371 | And I'm just taking off the S's and fixing the plurals under the singular just so that the code is self-explanatory. 372 | 373 | 94 374 | 00:06:29,560 --> 00:06:32,920 375 | We shouldn't be calling these countries when we're only getting one. 376 | 377 | 95 378 | 00:06:32,950 --> 00:06:33,390 379 | Correct. 380 | 381 | 96 382 | 00:06:34,450 --> 00:06:36,430 383 | So I'm just trying to make sure it's readable. 384 | 385 | 97 386 | 00:06:37,140 --> 00:06:37,470 387 | All right. 388 | 389 | 98 390 | 00:06:37,570 --> 00:06:43,490 391 | And then we're just going to see something went wrong in the name of get country. 392 | 393 | 99 394 | 00:06:44,260 --> 00:06:44,700 395 | All right. 396 | 397 | 100 398 | 00:06:44,980 --> 00:06:47,560 399 | So let us take this one for a spin. 400 | 401 | 101 402 | 00:06:47,560 --> 00:06:50,790 403 | So you see the gets really straightforward, right? 404 | 405 | 102 406 | 00:06:50,800 --> 00:06:56,830 407 | We did one there and we just took the quarter with a few modifications where potentially done with it. 408 | 409 | 103 410 | 00:06:56,830 --> 00:06:57,790 411 | So let's see what. 412 | 413 | 104 414 | 00:06:58,270 --> 00:07:01,460 415 | So the first thing I want to bring attention to is the documentation. 416 | 417 | 105 418 | 00:07:01,460 --> 00:07:07,450 419 | So you see API slash country and see API slash country slash IDE. 420 | 421 | 106 422 | 00:07:07,720 --> 00:07:13,020 423 | So that idea being displayed there is courtesy of our annotation here. 424 | 425 | 107 426 | 00:07:13,780 --> 00:07:14,220 427 | All right. 428 | 429 | 108 430 | 00:07:14,560 --> 00:07:21,910 431 | And then if we drilldown into it, you'll see that they're actually seeing that ID parameter is required. 432 | 433 | 109 434 | 00:07:22,450 --> 00:07:24,130 435 | No two ways about it. 436 | 437 | 110 438 | 00:07:24,550 --> 00:07:25,410 439 | It's required. 440 | 441 | 111 442 | 00:07:25,870 --> 00:07:26,250 443 | Right. 444 | 445 | 112 446 | 00:07:26,710 --> 00:07:29,380 447 | And if we say try it out, we can put in that. 448 | 449 | 113 450 | 00:07:29,620 --> 00:07:33,580 451 | But I'm going to put I'm going to use postmen to test this one. 452 | 453 | 114 454 | 00:07:33,580 --> 00:07:34,040 455 | All right. 456 | 457 | 115 458 | 00:07:34,480 --> 00:07:36,850 459 | So when I say get. 460 | 461 | 116 462 | 00:07:37,880 --> 00:07:46,640 463 | Right, with Bowsman and the same end point and says, and I'm getting the original get, which is getting 464 | 465 | 117 466 | 00:07:46,640 --> 00:07:53,300 467 | the list, no, when I modify this end point and I say slash one. 468 | 469 | 118 470 | 00:07:54,350 --> 00:08:01,130 471 | All right, and then click send look out what I get back, so I'm getting back only one result and this 472 | 473 | 119 474 | 00:08:01,130 --> 00:08:08,600 475 | is the idea and it's the list of hotels, which there's only one hotel associated with hotel number 476 | 477 | 120 478 | 00:08:08,600 --> 00:08:08,990 479 | one. 480 | 481 | 121 482 | 00:08:09,200 --> 00:08:11,980 483 | So country number one, there's only one hotel. 484 | 485 | 122 486 | 00:08:11,990 --> 00:08:13,240 487 | But this is unary. 488 | 489 | 123 490 | 00:08:13,700 --> 00:08:19,360 491 | So if there are more than all of them will be listed on that property or attributes. 492 | 493 | 124 494 | 00:08:19,610 --> 00:08:22,460 495 | And then the name is Jumia kind of short name is Jim. 496 | 497 | 125 498 | 00:08:22,590 --> 00:08:26,180 499 | So you see our second guest is working. 500 | 501 | 126 502 | 00:08:26,180 --> 00:08:32,920 503 | So let me just put our break point and show you exactly what is happening when we meet that request. 504 | 505 | 127 506 | 00:08:33,290 --> 00:08:40,250 507 | So putting our break point there and then clicking send again, Bridgepoint is activated. 508 | 509 | 128 510 | 00:08:40,410 --> 00:08:44,820 511 | If we look in the parameter listing, we see our value one coming over. 512 | 513 | 129 514 | 00:08:45,230 --> 00:08:45,890 515 | All right. 516 | 517 | 130 518 | 00:08:46,220 --> 00:08:48,890 519 | And then we can go ahead and. 520 | 521 | 131 522 | 00:08:50,180 --> 00:08:56,210 523 | I'm going to use Epton, so if it doesn't go into all of the method, cause what if I look at the country 524 | 525 | 132 526 | 00:08:56,210 --> 00:09:03,260 527 | object coming back, you see hotels and that's the list with only one idea, the name, the short name, 528 | 529 | 133 530 | 00:09:03,410 --> 00:09:04,750 531 | and then we do the mapping. 532 | 533 | 134 534 | 00:09:05,120 --> 00:09:09,500 535 | So no result has all of the data that was just in country. 536 | 537 | 135 538 | 00:09:09,650 --> 00:09:12,660 539 | And then it's going to return to Occy with results. 540 | 541 | 136 542 | 00:09:12,660 --> 00:09:19,700 543 | So it's automatically going to be serialized into serialized into JSON layouts. 544 | 545 | 137 546 | 00:09:20,680 --> 00:09:21,050 547 | All right. 548 | 549 | 138 550 | 00:09:21,260 --> 00:09:24,320 551 | And right there, we're done with our second get. 552 | 553 | 139 554 | 00:09:24,560 --> 00:09:33,380 555 | So now we know to get all I know, we know how to get by based on a particular requirements. 556 | -------------------------------------------------------------------------------- /3. Explore Swagger UI.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,840 --> 00:00:01,740 3 | Welcome back, guys. 4 | 5 | 2 6 | 00:00:01,770 --> 00:00:08,520 7 | So today we want to just have a quick run through of Swagga, how it ties into our API development and 8 | 9 | 3 10 | 00:00:08,520 --> 00:00:09,930 11 | what its purpose is. 12 | 13 | 4 14 | 00:00:10,350 --> 00:00:16,980 15 | So Swagga really is there to help simplify API development for users, teams and enterprises. 16 | 17 | 5 18 | 00:00:17,250 --> 00:00:25,290 19 | It's an open source tool set and it basically helps us to design and document our database with much 20 | 21 | 6 22 | 00:00:25,290 --> 00:00:29,350 23 | less effort than it would really take to have this level of detail. 24 | 25 | 7 26 | 00:00:29,370 --> 00:00:31,610 27 | So it's a really good tool. 28 | 29 | 8 30 | 00:00:31,800 --> 00:00:34,320 31 | It helps us to automate a lot of things. 32 | 33 | 9 34 | 00:00:34,560 --> 00:00:40,670 35 | And the best parts of it all is that it is already included with our API. 36 | 37 | 10 38 | 00:00:41,010 --> 00:00:44,200 39 | So in previous versions we would have to go and install it. 40 | 41 | 11 42 | 00:00:44,280 --> 00:00:51,780 43 | Granted, it wasn't a very difficult process, but now that Microsoft has seen that it is kind of a 44 | 45 | 12 46 | 00:00:51,780 --> 00:00:57,180 47 | standard that everybody with an API wants to put in structure because it's so cool, so efficient, 48 | 49 | 13 50 | 00:00:57,420 --> 00:01:03,180 51 | that's everything it's doing, then what they've done is they've actually just started packaging it 52 | 53 | 14 54 | 00:01:03,300 --> 00:01:05,320 55 | in our API for us. 56 | 57 | 15 58 | 00:01:05,670 --> 00:01:13,830 59 | So the main libraries that allows slogger to be integrated, well, one comes from this new get Puckett's. 60 | 61 | 16 62 | 00:01:13,830 --> 00:01:21,300 63 | If I go to managing to get package, we'll see that we have the package already installed for swashbucklers. 64 | 65 | 17 66 | 00:01:21,330 --> 00:01:23,410 67 | Not is the Internet's core. 68 | 69 | 18 70 | 00:01:23,930 --> 00:01:24,300 71 | Right. 72 | 73 | 19 74 | 00:01:24,360 --> 00:01:27,620 75 | Gives us the slogger tools then in our startup. 76 | 77 | 20 78 | 00:01:28,440 --> 00:01:32,310 79 | So remember that program that CSS calls the startup. 80 | 81 | 21 82 | 00:01:32,310 --> 00:01:35,430 83 | So startup is not where we define all the middleware. 84 | 85 | 22 86 | 00:01:35,790 --> 00:01:42,600 87 | And the one that we have in the services for software is services that add sluggard Jen. 88 | 89 | 23 90 | 00:01:42,930 --> 00:01:48,600 91 | We put in whether or not we either we if we were doing it manually, we would have to do this. 92 | 93 | 24 94 | 00:01:48,900 --> 00:01:53,750 95 | But because it was generated once again, we don't have that step. 96 | 97 | 25 98 | 00:01:53,760 --> 00:01:56,100 99 | So it will generate the Swiger document. 100 | 101 | 26 102 | 00:01:56,550 --> 00:01:58,350 103 | It supports versioning. 104 | 105 | 27 106 | 00:01:58,350 --> 00:02:05,580 107 | So if you have version one, version two, etc. off your API, you're able to keep track of the versions 108 | 109 | 28 110 | 00:02:05,580 --> 00:02:11,700 111 | or at least let whoever is reading the documentation or which version of the API they're looking at, 112 | 113 | 29 114 | 00:02:12,030 --> 00:02:15,600 115 | you can define certain open API information. 116 | 117 | 30 118 | 00:02:15,600 --> 00:02:17,910 119 | That is the title, the version. 120 | 121 | 31 122 | 00:02:18,120 --> 00:02:24,030 123 | If I click coming here, you'll see that you can add contact information, you can add a description, 124 | 125 | 32 126 | 00:02:24,300 --> 00:02:32,580 127 | license, all sorts of things to your documents or somebody's looking at your API documentation, knows 128 | 129 | 33 130 | 00:02:32,580 --> 00:02:33,610 131 | exactly who. 132 | 133 | 34 134 | 00:02:33,870 --> 00:02:42,180 135 | If you want to provide that level of detail and what this API is about later on or further down, rather, 136 | 137 | 35 138 | 00:02:42,210 --> 00:02:50,280 139 | in the configure section, we have the user swagga and app not use soggier UI. 140 | 141 | 36 142 | 00:02:50,280 --> 00:02:53,820 143 | So Swiger UI means you will create its own endpoint. 144 | 145 | 37 146 | 00:02:53,820 --> 00:02:59,940 147 | It will have its own kind of configuration file and it will call itself a listing if you want. 148 | 149 | 38 150 | 00:03:00,330 --> 00:03:00,570 151 | No. 152 | 153 | 39 154 | 00:03:00,570 --> 00:03:00,900 155 | Right. 156 | 157 | 40 158 | 00:03:00,900 --> 00:03:03,620 159 | No, this is under the end. 160 | 161 | 41 162 | 00:03:03,750 --> 00:03:05,370 163 | That is development. 164 | 165 | 42 166 | 00:03:05,370 --> 00:03:10,650 167 | So Env is just a variable that allows us to track which environment we're in. 168 | 169 | 43 170 | 00:03:10,650 --> 00:03:14,970 171 | Are we in development, are we in production right now? 172 | 173 | 44 174 | 00:03:15,150 --> 00:03:19,920 175 | Anything that goes in here is it's basically seeing we're in development. 176 | 177 | 45 178 | 00:03:19,920 --> 00:03:27,090 179 | So when we publish this to see as your I guess or, you know, to the Internet, whatever it is or wherever 180 | 181 | 46 182 | 00:03:27,090 --> 00:03:30,300 183 | it is we put it, don't do any of this stuff. 184 | 185 | 47 186 | 00:03:30,390 --> 00:03:32,790 187 | That's what this statement basically says. 188 | 189 | 48 190 | 00:03:33,240 --> 00:03:35,850 191 | No, I think software is useful. 192 | 193 | 49 194 | 00:03:35,940 --> 00:03:42,660 195 | So while they may have put it in the development parts, which I understand, I think that it's easier 196 | 197 | 50 198 | 00:03:42,660 --> 00:03:49,860 199 | to just include it in the API at all times so that when I published my API, I don't have to provide 200 | 201 | 51 202 | 00:03:49,860 --> 00:03:55,110 203 | as much technical support to somebody else to teach them how to use the API because that's what Soga 204 | 205 | 52 206 | 00:03:55,350 --> 00:03:56,670 207 | documentation is for. 208 | 209 | 53 210 | 00:03:57,660 --> 00:04:04,230 211 | So I'm going to just take these two lines out of that statement and place them in the general area where 212 | 213 | 54 214 | 00:04:04,230 --> 00:04:08,100 215 | everything else is going to get done regardless of the environment. 216 | 217 | 55 218 | 00:04:08,490 --> 00:04:10,650 219 | So that's my modification. 220 | 221 | 56 222 | 00:04:10,650 --> 00:04:13,230 223 | Once again, context is everything. 224 | 225 | 57 226 | 00:04:13,230 --> 00:04:20,490 227 | I can understand it for security reasons or just general lack of need for information exchange. 228 | 229 | 58 230 | 00:04:20,850 --> 00:04:27,780 231 | They probably said, well, you only look at it in a development setting because the developers may 232 | 233 | 59 234 | 00:04:27,780 --> 00:04:28,440 235 | be internal. 236 | 237 | 60 238 | 00:04:28,440 --> 00:04:35,070 239 | But and if it's for third party developers, then I'm going to make it external and publicly accessible. 240 | 241 | 61 242 | 00:04:35,520 --> 00:04:42,360 243 | So let's take a look at one of our controllers and the controller that we have. 244 | 245 | 62 246 | 00:04:42,690 --> 00:04:48,420 247 | And you see here, it gives us the weather forecast and the defense I get. 248 | 249 | 63 250 | 00:04:49,540 --> 00:04:51,340 251 | Method, all right. 252 | 253 | 64 254 | 00:04:51,580 --> 00:05:00,500 255 | No, if I run the application and the webpage comes up, we're seeing our Swiger documents. 256 | 257 | 65 258 | 00:05:01,060 --> 00:05:01,530 259 | All right. 260 | 261 | 66 262 | 00:05:01,720 --> 00:05:07,880 263 | So hotel listing version one, all of those were things defined in the startup. 264 | 265 | 67 266 | 00:05:08,110 --> 00:05:14,320 267 | So if you need to change the name or make it a bit more appealing, user friendly, human readable, 268 | 269 | 68 270 | 00:05:14,590 --> 00:05:21,420 271 | you can always change it inside of the configuration areas here and here. 272 | 273 | 69 274 | 00:05:21,500 --> 00:05:23,340 275 | Right there it is title. 276 | 277 | 70 278 | 00:05:24,040 --> 00:05:28,160 279 | So if you want to add a description of description, you will come up on the page. 280 | 281 | 71 282 | 00:05:28,910 --> 00:05:38,280 283 | Now, here it is showing us what is in the API and what's in the API would be our endpoint to get it 284 | 285 | 72 286 | 00:05:38,350 --> 00:05:40,840 287 | going back to the controller to get. 288 | 289 | 73 290 | 00:05:41,910 --> 00:05:43,290 291 | Weather forecast. 292 | 293 | 74 294 | 00:05:43,440 --> 00:05:50,370 295 | All right, so it's contextually generating this document based on what it sees in the project, only 296 | 297 | 75 298 | 00:05:50,610 --> 00:05:58,680 299 | that it will show you examples of what is going to come back when you try to retrieve anything, which 300 | 301 | 76 302 | 00:05:58,680 --> 00:06:07,290 303 | is exactly right, because this is returning at least off with a forecast and weather forecast series 304 | 305 | 77 306 | 00:06:07,510 --> 00:06:10,530 307 | is a class that has some data. 308 | 309 | 78 310 | 00:06:11,570 --> 00:06:17,610 311 | Feels defined on each one as a date data types, so date time, intent, intense string. 312 | 313 | 79 314 | 00:06:17,930 --> 00:06:25,250 315 | So you see if Swagga is actually taking all of them, see that it so you're going to get McAfee recorded 316 | 317 | 80 318 | 00:06:25,430 --> 00:06:30,110 319 | temperature C temperature if something is going to show you all of them. 320 | 321 | 81 322 | 00:06:30,290 --> 00:06:33,430 323 | And it is even giving you an idea of the data type. 324 | 325 | 82 326 | 00:06:33,470 --> 00:06:36,970 327 | This is a date time int industry. 328 | 329 | 83 330 | 00:06:37,190 --> 00:06:44,780 331 | So I'm just showing you how powerful Saugerties without any effort on our part to already have API documentation, 332 | 333 | 84 334 | 00:06:44,990 --> 00:06:52,400 335 | which once again is very important when you are going to be building a client application, consuming 336 | 337 | 85 338 | 00:06:52,400 --> 00:06:59,330 339 | an API, or if you are the one building the API, you make it easy for somebody who has to consume it. 340 | 341 | 86 342 | 00:06:59,330 --> 00:07:04,670 343 | So the same way you'd want to be treated as a consumer of somebodies API to have all the information 344 | 345 | 87 346 | 00:07:04,670 --> 00:07:06,350 347 | you need to know how to build around it. 348 | 349 | 88 350 | 00:07:06,560 --> 00:07:10,690 351 | You want to make sure you provide that information to persons interacting with yours. 352 | 353 | 89 354 | 00:07:11,180 --> 00:07:14,360 355 | So Swagga makes it out of the box very easy. 356 | 357 | 90 358 | 00:07:14,750 --> 00:07:20,420 359 | And just to push the envelope a bit, when we go to try it out, we can actually execute. 360 | 361 | 91 362 | 00:07:20,630 --> 00:07:26,120 363 | And Swagga allows us to actually test our API right here. 364 | 365 | 92 366 | 00:07:26,130 --> 00:07:32,150 367 | So these this data that's coming back with the statistical two hundred really gets into all of that 368 | 369 | 93 370 | 00:07:32,150 --> 00:07:32,780 371 | later on. 372 | 373 | 94 374 | 00:07:33,140 --> 00:07:40,010 375 | But you see the response, buddy, that's because it's actually executed the code that is here. 376 | 377 | 95 378 | 00:07:40,010 --> 00:07:45,590 379 | And just to prove that, if we click over in this page and we get this red dot, which is a break point, 380 | 381 | 96 382 | 00:07:45,920 --> 00:07:48,290 383 | so I'm just going to click execute again. 384 | 385 | 97 386 | 00:07:49,620 --> 00:07:55,800 387 | And then you see visual studio pauses and it hits this breakpoints is, you know, has this yellow in 388 | 389 | 98 390 | 00:07:55,800 --> 00:08:01,770 391 | it and that allows us to press every level and go line by line. 392 | 393 | 99 394 | 00:08:02,590 --> 00:08:04,440 395 | So I'm not trying to show you how to debug. 396 | 397 | 100 398 | 00:08:04,440 --> 00:08:08,100 399 | No, I'm just showing you that this is not fluff. 400 | 401 | 101 402 | 00:08:08,100 --> 00:08:11,040 403 | It actually will help us to test. 404 | 405 | 102 406 | 00:08:11,550 --> 00:08:16,610 407 | So now we have to test the utilities, Swiger and Posman. 408 | 409 | 103 410 | 00:08:17,010 --> 00:08:17,410 411 | All right. 412 | 413 | 104 414 | 00:08:17,820 --> 00:08:24,030 415 | So when I press five or I can continue up top here, whichever one, then it will just continue with 416 | 417 | 105 418 | 00:08:24,030 --> 00:08:26,810 419 | the execution and it will bring it back. 420 | 421 | 106 422 | 00:08:26,970 --> 00:08:27,460 423 | All right. 424 | 425 | 107 426 | 00:08:27,750 --> 00:08:32,830 427 | So that is how Swagga helps us in our quest for testing. 428 | 429 | 108 430 | 00:08:33,420 --> 00:08:37,110 431 | No, I'm just going to do two for one special. 432 | 433 | 109 434 | 00:08:37,440 --> 00:08:40,960 435 | And let's include over longer here. 436 | 437 | 110 438 | 00:08:41,700 --> 00:08:43,500 439 | So on top of already. 440 | 441 | 111 442 | 00:08:43,860 --> 00:08:45,960 443 | Well, by default it's injected. 444 | 445 | 112 446 | 00:08:45,960 --> 00:08:54,240 447 | So because we are using Cerillo as a default logger, when we do logging, using our object here, it 448 | 449 | 113 450 | 00:08:54,240 --> 00:08:55,510 451 | will use the silver logger. 452 | 453 | 114 454 | 00:08:55,540 --> 00:09:01,620 455 | So I'm just going to show you a little snippet of logging so I can see a logger dot and then I would 456 | 457 | 115 458 | 00:09:01,620 --> 00:09:04,080 459 | log information to see. 460 | 461 | 116 462 | 00:09:05,220 --> 00:09:10,480 463 | Accessed weather forecast. 464 | 465 | 117 466 | 00:09:11,640 --> 00:09:18,660 467 | All right, so this is just information to say access with the forecast and then I can see later on 468 | 469 | 118 470 | 00:09:19,020 --> 00:09:22,010 471 | with a forecast returned, something like that. 472 | 473 | 119 474 | 00:09:22,020 --> 00:09:29,790 475 | You know, it may not this this is elementary, but it's just once again, for example, seke. 476 | 477 | 120 478 | 00:09:30,240 --> 00:09:32,460 479 | So just see lugger. 480 | 481 | 121 482 | 00:09:34,260 --> 00:09:37,590 483 | Lowgar, oh, well, I'm sorry I put that too far down. 484 | 485 | 122 486 | 00:09:37,620 --> 00:09:39,810 487 | Here's a return statement, so. 488 | 489 | 123 490 | 00:09:41,940 --> 00:09:47,190 491 | Art, I'll just leave it has information for later on, we'll get to experiment more when we have our 492 | 493 | 124 494 | 00:09:47,190 --> 00:09:48,350 495 | own code to test it. 496 | 497 | 125 498 | 00:09:48,360 --> 00:09:59,190 499 | So I'm just going to run this application one sec and then I'm going to go ahead and try to click execute. 500 | 501 | 126 502 | 00:09:59,610 --> 00:10:01,770 503 | I can remove the breakpoint by just clicking. 504 | 505 | 127 506 | 00:10:01,780 --> 00:10:04,410 507 | So as long as that red dot is there, it's going to stop. 508 | 509 | 128 510 | 00:10:04,410 --> 00:10:09,120 511 | When it gets to that line, you just remove the red dot and F for it to continue. 512 | 513 | 129 514 | 00:10:09,450 --> 00:10:09,870 515 | All right. 516 | 517 | 130 518 | 00:10:09,870 --> 00:10:10,800 519 | So it's executed. 520 | 521 | 131 522 | 00:10:10,810 --> 00:10:15,210 523 | Let me see if my love is going to show me anything useful. 524 | 525 | 132 526 | 00:10:15,220 --> 00:10:16,130 527 | Let me try and find. 528 | 529 | 133 530 | 00:10:16,380 --> 00:10:17,280 531 | And there we go. 532 | 533 | 134 534 | 00:10:17,310 --> 00:10:24,030 535 | So this is not a love files all the times that we've actually opened it up and it did something you 536 | 537 | 135 538 | 00:10:24,030 --> 00:10:25,580 539 | see here, it's right in the log. 540 | 541 | 136 542 | 00:10:25,600 --> 00:10:33,060 543 | So here is our first log application is starting and the need log that this did that, that. 544 | 545 | 137 546 | 00:10:33,270 --> 00:10:38,310 547 | And here's the one that we just wrote, accessed weather forecasts. 548 | 549 | 138 550 | 00:10:38,310 --> 00:10:38,600 551 | Right. 552 | 553 | 139 554 | 00:10:38,880 --> 00:10:43,830 555 | And then it's telling you all of the details of what it's doing and getting on this and that. 556 | 557 | 140 558 | 00:10:43,830 --> 00:10:44,100 559 | Right. 560 | 561 | 141 562 | 00:10:44,100 --> 00:10:46,050 563 | So that's all logging works. 564 | 565 | 142 566 | 00:10:46,050 --> 00:10:47,730 567 | That's all soggier works. 568 | -------------------------------------------------------------------------------- /5. Add User Roles.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,680 --> 00:00:01,730 3 | Hey, guys, welcome back. 4 | 5 | 2 6 | 00:00:01,760 --> 00:00:09,580 7 | So one very important parts of user authorization is knowing what role this users in appointing, though 8 | 9 | 3 10 | 00:00:09,590 --> 00:00:15,260 11 | we haven't done anything associated with roles who are more preoccupied with getting the user information, 12 | 13 | 4 14 | 00:00:15,260 --> 00:00:18,080 15 | validating it and whether we create the user or not. 16 | 17 | 5 18 | 00:00:18,560 --> 00:00:26,240 19 | Now, when it comes to rules, the rules that are allowed need to exist in the system prior to the system 20 | 21 | 6 22 | 00:00:26,240 --> 00:00:26,930 23 | being used. 24 | 25 | 7 26 | 00:00:27,620 --> 00:00:34,880 27 | So the same way that we would have set up these operations for hotels and countries of less importance 28 | 29 | 8 30 | 00:00:34,880 --> 00:00:37,130 31 | really than rules would be. 32 | 33 | 9 34 | 00:00:37,140 --> 00:00:42,650 35 | So we want to make sure that the rules are there from the get go so that when the users start registering, 36 | 37 | 10 38 | 00:00:42,830 --> 00:00:44,540 39 | the rules are already there. 40 | 41 | 11 42 | 00:00:45,320 --> 00:00:47,690 43 | So what we want to do is see them. 44 | 45 | 12 46 | 00:00:47,690 --> 00:00:52,670 47 | But instead of ceding them the way that we see the country and who, I'm going to show you the way that 48 | 49 | 13 50 | 00:00:52,670 --> 00:01:00,260 51 | we can obstruct that operation from our DB contacts and keep the BB context as light as possible, similar 52 | 53 | 14 54 | 00:01:00,260 --> 00:01:05,780 55 | to what I need to do that with our services that we are installing. 56 | 57 | 15 58 | 00:01:06,110 --> 00:01:08,720 59 | So what I'm going to do is set up a new folder. 60 | 61 | 16 62 | 00:01:08,750 --> 00:01:14,270 63 | I have configurations or that I'm just going to go ahead and add another folder inside that that I'm 64 | 65 | 17 66 | 00:01:14,270 --> 00:01:15,590 67 | going to call entities. 68 | 69 | 18 70 | 00:01:16,160 --> 00:01:22,340 71 | So configurations for anything that is entity related and then I'm going to add a class and then I want 72 | 73 | 19 74 | 00:01:22,340 --> 00:01:27,380 75 | to call this class roll configuration, go ahead and add it. 76 | 77 | 20 78 | 00:01:27,860 --> 00:01:32,450 79 | And then this rule configuration class is inheriting from entity. 80 | 81 | 21 82 | 00:01:33,510 --> 00:01:36,240 83 | Type configuration. 84 | 85 | 22 86 | 00:01:38,650 --> 00:01:42,670 87 | And it will be of the type identity role. 88 | 89 | 23 90 | 00:01:43,300 --> 00:01:46,920 91 | All right, go ahead and include any missing references. 92 | 93 | 24 94 | 00:01:47,350 --> 00:01:49,690 95 | So we're just listing rule configuration, all that. 96 | 97 | 25 98 | 00:01:49,690 --> 00:01:54,280 99 | It's going to be associated with that configuration type. 100 | 101 | 26 102 | 00:01:54,290 --> 00:02:00,730 103 | And of course, we have to go ahead and implement whatever this is seeing needs to be implemented, 104 | 105 | 27 106 | 00:02:02,140 --> 00:02:09,700 107 | which is our configure function or so it's automatically going to pass or the same builder that is in 108 | 109 | 28 110 | 00:02:09,700 --> 00:02:12,000 111 | use on model creating. 112 | 113 | 29 114 | 00:02:12,610 --> 00:02:22,390 115 | So then we can actually replicate the code that we have where we say builder DOT has data. 116 | 117 | 30 118 | 00:02:24,570 --> 00:02:34,030 119 | And then instead of building the test data, we can go ahead and create new rules, new rule objects. 120 | 121 | 31 122 | 00:02:34,380 --> 00:02:38,550 123 | So let me just sort of these quotation marks. 124 | 125 | 32 126 | 00:02:39,270 --> 00:02:39,600 127 | All right. 128 | 129 | 33 130 | 00:02:39,840 --> 00:02:42,150 131 | So a new identity rule. 132 | 133 | 34 134 | 00:02:44,140 --> 00:02:46,750 135 | And we're just going to initialize this object. 136 | 137 | 35 138 | 00:02:46,780 --> 00:02:53,260 139 | I'm not going to give it an idea, it was sort of an ad, but the name that's called this one user. 140 | 141 | 36 142 | 00:02:54,640 --> 00:03:01,120 143 | And we have to give it a normalized name, which is really just capitalized version of that. 144 | 145 | 37 146 | 00:03:02,270 --> 00:03:07,430 147 | The of the name, really, and then I'm also going to give it. 148 | 149 | 38 150 | 00:03:09,940 --> 00:03:13,570 151 | Administrator, hospital administrator. 152 | 153 | 39 154 | 00:03:14,870 --> 00:03:23,130 155 | And then the normalized is all caps version of the ministry or ministry. 156 | 157 | 40 158 | 00:03:23,150 --> 00:03:24,950 159 | So always make sure the spending is right. 160 | 161 | 41 162 | 00:03:24,980 --> 00:03:29,090 163 | I've spent these debugging but spilling, so don't be like me. 164 | 165 | 42 166 | 00:03:30,020 --> 00:03:30,440 167 | All right. 168 | 169 | 43 170 | 00:03:31,130 --> 00:03:36,260 171 | So now that we have this configured method and as many rules as you think you may need, you can go 172 | 173 | 44 174 | 00:03:36,260 --> 00:03:37,510 175 | ahead and configure them. 176 | 177 | 45 178 | 00:03:37,520 --> 00:03:44,570 179 | But the most important parts of all of that is when we're ready to put it into the system. 180 | 181 | 46 182 | 00:03:44,570 --> 00:03:46,550 183 | We need only say builder. 184 | 185 | 47 186 | 00:03:49,250 --> 00:03:51,590 187 | Not apply. 188 | 189 | 48 190 | 00:03:53,040 --> 00:04:03,210 191 | Sorry, Bill Der not apply configuration, and then I'm just going to see a new role. 192 | 193 | 49 194 | 00:04:04,270 --> 00:04:05,650 195 | Configuration. 196 | 197 | 50 198 | 00:04:09,820 --> 00:04:15,650 199 | And then include the missing reference store you created and there we go. 200 | 201 | 51 202 | 00:04:15,880 --> 00:04:21,290 203 | So you see, that looks much to me that looks much neater than having all of this in this file. 204 | 205 | 52 206 | 00:04:21,340 --> 00:04:28,090 207 | Remember that the reason we moved it from the top here above the list was that it was so huge a function 208 | 209 | 53 210 | 00:04:28,090 --> 00:04:29,620 211 | because of all these lines. 212 | 213 | 54 214 | 00:04:29,950 --> 00:04:37,090 215 | So if you want, you can pause right now and attempt to build other configuration files for country 216 | 217 | 55 218 | 00:04:37,090 --> 00:04:37,990 219 | and hotel. 220 | 221 | 56 222 | 00:04:38,860 --> 00:04:45,370 223 | All right, so I hope you actually attempted it because I did it right, so I'm not going to ask you 224 | 225 | 57 226 | 00:04:45,370 --> 00:04:46,030 227 | to do anything. 228 | 229 | 58 230 | 00:04:46,030 --> 00:04:49,600 231 | I'm not going to do so just in case you need some guidance. 232 | 233 | 59 234 | 00:04:50,020 --> 00:04:55,030 235 | We I went ahead and created configuration files per type. 236 | 237 | 60 238 | 00:04:55,420 --> 00:04:55,770 239 | All right. 240 | 241 | 61 242 | 00:04:55,780 --> 00:04:58,570 243 | So we have hotel and we have country and we have rules. 244 | 245 | 62 246 | 00:04:58,570 --> 00:05:00,160 247 | So we created a all together. 248 | 249 | 63 250 | 00:05:00,160 --> 00:05:01,270 251 | I did country. 252 | 253 | 64 254 | 00:05:01,630 --> 00:05:02,980 255 | Same name. 256 | 257 | 65 258 | 00:05:03,280 --> 00:05:09,410 259 | Basically, you could copy and paste according to the essential parts control configuration that I into 260 | 261 | 66 262 | 00:05:09,410 --> 00:05:15,460 263 | the type configuration relative to country as a contextless and then the same code that was there to 264 | 265 | 67 266 | 00:05:15,460 --> 00:05:16,360 267 | create the country's. 268 | 269 | 68 270 | 00:05:16,360 --> 00:05:18,040 271 | I just cut and paste. 272 | 273 | 69 274 | 00:05:18,340 --> 00:05:18,690 275 | All right. 276 | 277 | 70 278 | 00:05:18,850 --> 00:05:26,500 279 | The only thing is that in the previous one we had builder dot entity, something like that, and I removed 280 | 281 | 71 282 | 00:05:26,500 --> 00:05:27,730 283 | that DOT entity part. 284 | 285 | 72 286 | 00:05:27,740 --> 00:05:29,350 287 | So it's just builder that has data. 288 | 289 | 73 290 | 00:05:29,350 --> 00:05:36,220 291 | So you can go ahead and replicate that across both country and hotel. 292 | 293 | 74 294 | 00:05:36,230 --> 00:05:41,920 295 | And if you're doing your own thing across any other one, I know you're on model building looks much 296 | 297 | 75 298 | 00:05:42,130 --> 00:05:42,670 299 | cleaner. 300 | 301 | 76 302 | 00:05:43,010 --> 00:05:43,330 303 | Right. 304 | 305 | 77 306 | 00:05:43,700 --> 00:05:45,450 307 | And I think I just put this one. 308 | 309 | 78 310 | 00:05:45,460 --> 00:05:51,640 311 | I don't really think it matters where in terms of order, but I just put it on the bottom since that's 312 | 313 | 79 314 | 00:05:51,640 --> 00:05:54,340 315 | the order in which everything was being created anyway. 316 | 317 | 80 318 | 00:05:54,340 --> 00:05:59,170 319 | So country then hotel, then we have the rules once again. 320 | 321 | 81 322 | 00:05:59,170 --> 00:06:05,840 323 | These two are really optional in terms of what's really needed to get the application up and running. 324 | 325 | 82 326 | 00:06:05,990 --> 00:06:06,160 327 | Right. 328 | 329 | 83 330 | 00:06:07,240 --> 00:06:14,440 331 | So now that we have the rule configuration or seating, we can all just add migration and see added 332 | 333 | 84 334 | 00:06:14,590 --> 00:06:16,540 335 | default rules. 336 | 337 | 85 338 | 00:06:17,260 --> 00:06:25,830 339 | And that and the resulting migration file has two entries into our rules file. 340 | 341 | 86 342 | 00:06:25,840 --> 00:06:27,820 343 | So you see generated its own ID. 344 | 345 | 87 346 | 00:06:27,820 --> 00:06:30,670 347 | That's why I didn't bother to modify that. 348 | 349 | 88 350 | 00:06:30,670 --> 00:06:32,980 351 | But then we get user and we get administrator. 352 | 353 | 89 354 | 00:06:33,310 --> 00:06:39,610 355 | So when we do update database, it will go ahead and do the insert. 356 | 357 | 90 358 | 00:06:40,330 --> 00:06:43,640 359 | So once that is done, we have two other changes to make. 360 | 361 | 91 362 | 00:06:43,660 --> 00:06:50,160 363 | So one is in the user D to introduce this collection of type string and I'm calling its rolls. 364 | 365 | 92 366 | 00:06:50,600 --> 00:06:50,870 367 | Right. 368 | 369 | 93 370 | 00:06:50,890 --> 00:06:56,950 371 | So we're giving the user the opportunity to see which rule or rules should this person have. 372 | 373 | 94 374 | 00:06:57,430 --> 00:06:57,940 375 | Right. 376 | 377 | 95 378 | 00:06:58,180 --> 00:07:00,520 379 | And then in the account controller. 380 | 381 | 96 382 | 00:07:01,490 --> 00:07:09,740 383 | Right after we have vetted if the registration attempt was successful or not, are the user creation 384 | 385 | 97 386 | 00:07:09,740 --> 00:07:14,240 387 | operation was successful or not run, remember, if it gets beyond that is a statement, it means that 388 | 389 | 98 390 | 00:07:14,240 --> 00:07:15,210 391 | it was successful. 392 | 393 | 99 394 | 00:07:15,500 --> 00:07:24,170 395 | Then we take the extra step of seeing user manager that not add rules async and we're adding to the 396 | 397 | 100 398 | 00:07:24,170 --> 00:07:30,010 399 | user that was just created the role that came in our rules that came in. 400 | 401 | 101 402 | 00:07:30,020 --> 00:07:39,040 403 | So if you look at this, it has a few overrides, one over it allows it to or not over the overload. 404 | 405 | 102 406 | 00:07:39,050 --> 00:07:39,550 407 | Sorry. 408 | 409 | 103 410 | 00:07:39,590 --> 00:07:46,010 411 | So the one overload allows you to just passing in a list of rules that it will just go ahead and add 412 | 413 | 104 414 | 00:07:46,010 --> 00:07:46,900 415 | to this user. 416 | 417 | 105 418 | 00:07:46,910 --> 00:07:53,300 419 | So once the rule exists, then it will be associated with the user in the bucket once again, built 420 | 421 | 106 422 | 00:07:53,300 --> 00:07:57,370 423 | in function, not much code or if needed on our part. 424 | 425 | 107 426 | 00:07:57,650 --> 00:07:59,070 427 | So let us do this for a spin. 428 | 429 | 108 430 | 00:07:59,270 --> 00:08:04,610 431 | So in Swagga, you see that they are modifying the potential values, right, so that they are showing 432 | 433 | 109 434 | 00:08:04,610 --> 00:08:07,280 435 | that they can pass in an area called rules. 436 | 437 | 110 438 | 00:08:07,730 --> 00:08:11,540 439 | So the area is the square brackets, whereas an object is occurring. 440 | 441 | 111 442 | 00:08:12,470 --> 00:08:13,580 443 | So let's try it out. 444 | 445 | 112 446 | 00:08:13,970 --> 00:08:20,060 447 | And I'm going to leave this same user as the same user that we've got success with last time. 448 | 449 | 113 450 | 00:08:20,570 --> 00:08:21,120 451 | Right. 452 | 453 | 114 454 | 00:08:21,260 --> 00:08:25,970 455 | So that means I should get some validation message to see it shouldn't work, but I'm going to pass 456 | 457 | 115 458 | 00:08:25,970 --> 00:08:31,890 459 | in the role of user and when they execute and then here's what I'm getting. 460 | 461 | 116 462 | 00:08:31,910 --> 00:08:35,600 463 | So the result is that I have a 400 board request. 464 | 465 | 117 466 | 00:08:35,900 --> 00:08:37,880 467 | Duplicate email is the issue. 468 | 469 | 118 470 | 00:08:37,880 --> 00:08:38,930 471 | It's already taken. 472 | 473 | 119 474 | 00:08:38,930 --> 00:08:40,880 475 | So that validation is working. 476 | 477 | 120 478 | 00:08:40,890 --> 00:08:52,930 479 | So let's see, user at hotels, hotel listing, dot com does something different and that's the user. 480 | 481 | 121 482 | 00:08:53,330 --> 00:08:56,450 483 | So I'll go ahead and execute. 484 | 485 | 122 486 | 00:08:56,900 --> 00:09:00,140 487 | And what I'm getting is not a bad response. 488 | 489 | 123 490 | 00:09:00,350 --> 00:09:00,800 491 | All right. 492 | 493 | 124 494 | 00:09:00,810 --> 00:09:01,600 495 | That looks good. 496 | 497 | 125 498 | 00:09:01,850 --> 00:09:05,990 499 | So let's us see what happened in the database after those operations. 500 | 501 | 126 502 | 00:09:07,560 --> 00:09:13,170 503 | So I'm going to kill the execution, go over to the server manager and first, then want to look into 504 | 505 | 127 506 | 00:09:13,170 --> 00:09:19,020 507 | user status, I should have at least two users based on my tests so far, and they will go away. 508 | 509 | 128 510 | 00:09:19,020 --> 00:09:22,350 511 | I use a total listing and user at example. 512 | 513 | 129 514 | 00:09:22,800 --> 00:09:23,220 515 | All right. 516 | 517 | 130 518 | 00:09:23,230 --> 00:09:24,050 519 | So that's good. 520 | 521 | 131 522 | 00:09:24,630 --> 00:09:28,030 523 | The next one would be the rolls. 524 | 525 | 132 526 | 00:09:28,050 --> 00:09:31,920 527 | So I just scaffolded the rules myself. 528 | 529 | 133 530 | 00:09:31,920 --> 00:09:33,030 531 | I just see that the rules. 532 | 533 | 134 534 | 00:09:33,110 --> 00:09:35,040 535 | And so these other rules that we created. 536 | 537 | 135 538 | 00:09:35,190 --> 00:09:39,720 539 | However, the User Roll Association is stored here because it's a many to many. 540 | 541 | 136 542 | 00:09:39,720 --> 00:09:42,960 543 | So they're seeing that many users rights have many rules. 544 | 545 | 137 546 | 00:09:43,350 --> 00:09:43,700 547 | Right. 548 | 549 | 138 550 | 00:09:43,740 --> 00:09:51,060 551 | So that's why we allowed Honoria, because maybe one user might be administrator and user, maybe and 552 | 553 | 139 554 | 00:09:51,060 --> 00:09:55,440 555 | supervisor etc, etc. based on this system, it's all context. 556 | 557 | 140 558 | 00:09:55,440 --> 00:09:55,710 559 | Right. 560 | 561 | 141 562 | 00:09:56,340 --> 00:10:03,060 563 | However, in this table, when we view data, then we should see the user ID associated with the roll. 564 | 565 | 142 566 | 00:10:03,680 --> 00:10:04,440 567 | Right. 568 | 569 | 143 570 | 00:10:04,720 --> 00:10:04,770 571 | Right. 572 | 573 | 144 574 | 00:10:04,770 --> 00:10:09,600 575 | So if we were to just go back and double check, you see that this is the user ID. 576 | 577 | 145 578 | 00:10:09,600 --> 00:10:12,870 579 | There was no ending eight F seven. 580 | 581 | 146 582 | 00:10:13,240 --> 00:10:19,890 583 | So if I look at that same user ID and if seven and the rules seven, five, five. 584 | 585 | 147 586 | 00:10:19,890 --> 00:10:24,380 587 | So you have to go to this one to see which one is seven five five which is user. 588 | 589 | 148 590 | 00:10:24,600 --> 00:10:25,290 591 | So that is all. 592 | 593 | 149 594 | 00:10:25,290 --> 00:10:33,930 595 | We start integrating rules based authorization into our systems and all our users when they get registered, 596 | 597 | 150 598 | 00:10:34,320 --> 00:10:37,200 599 | will get registered with their appropriate rules. 600 | -------------------------------------------------------------------------------- /3. Install and Explore PostMan.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,330 --> 00:00:05,400 3 | Hey, guys, in this video we're going to be installing Postman No Postman is an excellent tool for 4 | 5 | 2 6 | 00:00:05,400 --> 00:00:10,310 7 | collaboration and API testing and validation on all of those wonderful things. 8 | 9 | 3 10 | 00:00:10,530 --> 00:00:12,810 11 | So it's pretty easy to install really. 12 | 13 | 4 14 | 00:00:12,810 --> 00:00:17,490 15 | Just go to postman dot com postman, just like the guy who delivers your mail. 16 | 17 | 5 18 | 00:00:17,730 --> 00:00:18,960 19 | Postman dot com. 20 | 21 | 6 22 | 00:00:19,230 --> 00:00:20,430 23 | You download the app. 24 | 25 | 7 26 | 00:00:21,970 --> 00:00:28,830 27 | And of course, you choose your oil, so I have a 64 bit windows and then the oil starts. 28 | 29 | 8 30 | 00:00:29,620 --> 00:00:34,750 31 | All right, so once that download is finished, you can go ahead and open the installation file, run 32 | 33 | 9 34 | 00:00:34,750 --> 00:00:35,620 35 | the installer. 36 | 37 | 10 38 | 00:00:40,030 --> 00:00:46,330 39 | All right, so when it is finished, you will either see a screen prompting you to sign up or sign in 40 | 41 | 11 42 | 00:00:46,540 --> 00:00:49,990 43 | or you'll see the screen either way if you see something to sign in. 44 | 45 | 12 46 | 00:00:50,260 --> 00:00:51,920 47 | I would encourage you to do so. 48 | 49 | 13 50 | 00:00:51,920 --> 00:00:53,880 51 | I actually have it on my machine already. 52 | 53 | 14 54 | 00:00:54,130 --> 00:01:01,270 55 | So, you know, the floor may not be exactly like this, but if you do see this page come up, then 56 | 57 | 15 58 | 00:01:01,270 --> 00:01:01,690 59 | it's fine. 60 | 61 | 16 62 | 00:01:01,690 --> 00:01:04,600 63 | You can just click the X and you can take it off. 64 | 65 | 17 66 | 00:01:04,960 --> 00:01:07,080 67 | And I'm not signed in anyway. 68 | 69 | 18 70 | 00:01:07,090 --> 00:01:13,600 71 | So if you do see the R sign up screen looking something like this, then you can just go ahead and create 72 | 73 | 19 74 | 00:01:13,600 --> 00:01:14,330 75 | an account. 76 | 77 | 20 78 | 00:01:14,530 --> 00:01:15,310 79 | Sorry about that. 80 | 81 | 21 82 | 00:01:15,330 --> 00:01:17,830 83 | You can create an account quite easily. 84 | 85 | 22 86 | 00:01:18,010 --> 00:01:21,110 87 | Username, password, or you just signing with Google. 88 | 89 | 23 90 | 00:01:21,190 --> 00:01:22,810 91 | I like to just sign in with Google. 92 | 93 | 24 94 | 00:01:22,990 --> 00:01:27,910 95 | And the thing is that course I will keep a history of every test that you have done once you have enough 96 | 97 | 25 98 | 00:01:27,910 --> 00:01:28,450 99 | account. 100 | 101 | 26 102 | 00:01:28,570 --> 00:01:28,920 103 | All right. 104 | 105 | 27 106 | 00:01:28,930 --> 00:01:34,840 107 | So I'm just going to go ahead and sign in with Google and then once you're signed in, then, you know, 108 | 109 | 28 110 | 00:01:34,840 --> 00:01:36,250 111 | you can start working. 112 | 113 | 29 114 | 00:01:36,280 --> 00:01:40,730 115 | So I'm just going to show you guys a sample of what Posman is capable of. 116 | 117 | 30 118 | 00:01:41,350 --> 00:01:47,320 119 | Firstly, I'm going to suggest what's a dark moat because Darmody school and then I'm going to create 120 | 121 | 31 122 | 00:01:47,320 --> 00:01:48,540 123 | a new request window. 124 | 125 | 32 126 | 00:01:48,550 --> 00:01:53,230 127 | So using this plus sign, just like any browser with the plus signs at the top, you can just see a 128 | 129 | 33 130 | 00:01:53,230 --> 00:01:56,050 131 | plus sign and that gives you a new request. 132 | 133 | 34 134 | 00:01:56,380 --> 00:02:04,540 135 | No, I already went ahead and searched for some public APIs as we discussed APIs based on our gateway 136 | 137 | 35 138 | 00:02:04,540 --> 00:02:05,740 139 | into your database. 140 | 141 | 36 142 | 00:02:05,750 --> 00:02:13,120 143 | So people have APIs, various people have APIs and I found this website and Nidetch API dot com and 144 | 145 | 37 146 | 00:02:13,300 --> 00:02:18,710 147 | just try and go back to the very first page so you can see what they have to offer. 148 | 149 | 38 150 | 00:02:19,060 --> 00:02:24,460 151 | So from the, you know, the landing page, they show you a bunch of public facing API. 152 | 153 | 39 154 | 00:02:24,460 --> 00:02:29,090 155 | So you can just go ahead and click one and test it out. 156 | 157 | 40 158 | 00:02:29,500 --> 00:02:34,780 159 | So I went over to the Oxford Dictionary, one where I would get a list of languages. 160 | 161 | 41 162 | 00:02:34,780 --> 00:02:36,720 163 | So they show you all of the endpoints. 164 | 165 | 42 166 | 00:02:36,730 --> 00:02:37,060 167 | Right. 168 | 169 | 43 170 | 00:02:37,510 --> 00:02:43,450 171 | So in building all the API, they link to the data, be assured they have a common URL, but then they 172 | 173 | 44 174 | 00:02:43,450 --> 00:02:46,840 175 | have different endpoints that will give different bits of information. 176 | 177 | 45 178 | 00:02:46,860 --> 00:02:47,090 179 | Right. 180 | 181 | 46 182 | 00:02:47,590 --> 00:02:53,170 183 | And then they have different methods, get and post the potential of some other ones. 184 | 185 | 47 186 | 00:02:53,180 --> 00:02:55,930 187 | But the fact is that you have to know the request type. 188 | 189 | 48 190 | 00:02:56,350 --> 00:03:02,800 191 | You have to know the URL through which you can get that requests satisfied. 192 | 193 | 49 194 | 00:03:03,050 --> 00:03:05,140 195 | You have to know if you have to pass in headers. 196 | 197 | 50 198 | 00:03:05,330 --> 00:03:13,250 199 | So here I know I need the applications G and ID and then they show me the responses. 200 | 201 | 51 202 | 00:03:13,270 --> 00:03:15,000 203 | So two hundred means OK. 204 | 205 | 52 206 | 00:03:15,340 --> 00:03:19,950 207 | And then they show me an example in Jason what that response would be. 208 | 209 | 53 210 | 00:03:20,200 --> 00:03:22,410 211 | And then for four means not phoned. 212 | 213 | 54 214 | 00:03:22,570 --> 00:03:27,420 215 | Five hundred means that there is an internal error usually with the home server. 216 | 217 | 55 218 | 00:03:27,430 --> 00:03:28,150 219 | Not with you. 220 | 221 | 56 222 | 00:03:28,330 --> 00:03:28,690 223 | Right. 224 | 225 | 57 226 | 00:03:28,720 --> 00:03:31,840 227 | So four four means that you're probably searching for something that doesn't exist. 228 | 229 | 58 230 | 00:03:32,240 --> 00:03:42,250 231 | Five hundred means that the API provider has an error message from any API and want to free for free 232 | 233 | 59 234 | 00:03:42,250 --> 00:03:43,470 235 | forex API. 236 | 237 | 60 238 | 00:03:44,020 --> 00:03:44,430 239 | Sorry. 240 | 241 | 61 242 | 00:03:44,440 --> 00:03:49,990 243 | So I took a closer look at any API and I realized that all of those APIs require that you would have 244 | 245 | 62 246 | 00:03:49,990 --> 00:03:55,720 247 | had enough code to be a registered user, probably paying user off those platforms. 248 | 249 | 63 250 | 00:03:55,730 --> 00:04:01,180 251 | You can look through you see Instagram, you see YouTube, Google, most of those are protected API. 252 | 253 | 64 254 | 00:04:01,180 --> 00:04:03,580 255 | So they're using some moments of security around it. 256 | 257 | 65 258 | 00:04:03,820 --> 00:04:07,420 259 | And we're going to go through all of those techniques in this course. 260 | 261 | 66 262 | 00:04:07,420 --> 00:04:12,670 263 | But right now, I just want to talk with Quick-witted and satisfaction of seeing what Posman can do 264 | 265 | 67 266 | 00:04:12,670 --> 00:04:13,680 267 | and the relevance of it. 268 | 269 | 68 270 | 00:04:13,690 --> 00:04:13,940 271 | Right. 272 | 273 | 69 274 | 00:04:14,320 --> 00:04:18,490 275 | So I phoned the free for x API dot com. 276 | 277 | 70 278 | 00:04:18,490 --> 00:04:18,840 279 | Right. 280 | 281 | 71 282 | 00:04:18,880 --> 00:04:24,520 283 | You can just type that in free for API dot com and then we'll go over to documentation. 284 | 285 | 72 286 | 00:04:24,520 --> 00:04:31,090 287 | So that landing page is actually there, a demo of them consuming the data through the API that they're 288 | 289 | 73 290 | 00:04:31,110 --> 00:04:31,720 291 | exposing. 292 | 293 | 74 294 | 00:04:31,720 --> 00:04:32,020 295 | Right. 296 | 297 | 75 298 | 00:04:32,020 --> 00:04:38,830 299 | So they have a database that builds an API and then the they're making a series of API calls to show 300 | 301 | 76 302 | 00:04:38,830 --> 00:04:43,930 303 | the treating index between Yuren USD and GBP etc, etc.. 304 | 305 | 77 306 | 00:04:43,930 --> 00:04:50,790 307 | So if I go to documentation, they will give me the terms of use, tell me how to use it. 308 | 309 | 78 310 | 00:04:50,800 --> 00:04:56,620 311 | So documentation is very, very important and vital when it comes to the API is that we'll be using 312 | 313 | 79 314 | 00:04:56,920 --> 00:05:06,010 315 | Swagga Swanger UI to our swashbucklers when we get there you'll see, but we'll be focusing on documenting 316 | 317 | 80 318 | 00:05:06,010 --> 00:05:09,550 319 | our APIs to a great extent also. 320 | 321 | 81 322 | 00:05:10,180 --> 00:05:17,500 323 | So from here they show you that you have the data that's the domain that the API is hosted on. 324 | 325 | 82 326 | 00:05:17,800 --> 00:05:18,340 327 | Right. 328 | 329 | 83 330 | 00:05:18,620 --> 00:05:24,730 331 | And then as you grow, don't you see the different types of functionality that they explicitly say get 332 | 333 | 84 334 | 00:05:25,120 --> 00:05:26,440 335 | great data? 336 | 337 | 85 338 | 00:05:26,470 --> 00:05:26,860 339 | Right. 340 | 341 | 86 342 | 00:05:26,890 --> 00:05:35,410 343 | And then they say to me, the request it is gets requests and then you have the the the endpoint sorry, 344 | 345 | 87 346 | 00:05:35,410 --> 00:05:37,030 347 | the Yooralla and the endpoint. 348 | 349 | 88 350 | 00:05:37,030 --> 00:05:38,350 351 | That's what it needs to look like. 352 | 353 | 89 354 | 00:05:38,560 --> 00:05:39,250 355 | And this is a. 356 | 357 | 90 358 | 00:05:39,320 --> 00:05:40,730 359 | Sample response. 360 | 361 | 91 362 | 00:05:41,060 --> 00:05:46,760 363 | All right, and if you look through, you see another one that you can get different, Piers, so right 364 | 365 | 92 366 | 00:05:46,760 --> 00:05:52,280 367 | here you're only looking at the euro, the one on the return that the results of that quarter for you. 368 | 369 | 93 370 | 00:05:53,360 --> 00:05:56,530 371 | And then in this one, you can get more than one if you want. 372 | 373 | 94 374 | 00:05:56,540 --> 00:06:01,680 375 | So you just put in both indexes that you're interested in as the parameter in that endpoint. 376 | 377 | 95 378 | 00:06:02,180 --> 00:06:02,420 379 | All right. 380 | 381 | 96 382 | 00:06:02,510 --> 00:06:05,630 383 | So that's a query string for the values the queries are on. 384 | 385 | 97 386 | 00:06:05,750 --> 00:06:09,290 387 | And then this is the response from the API. 388 | 389 | 98 390 | 00:06:09,290 --> 00:06:12,170 391 | Once that queries are on and the data is is phoned. 392 | 393 | 99 394 | 00:06:12,620 --> 00:06:18,800 395 | No, the error codes tell a good story because then you if you pass in two piers that don't exist in 396 | 397 | 100 398 | 00:06:18,800 --> 00:06:24,830 399 | their system, then they're telling you that it's if you don't pass in any setting, it's required. 400 | 401 | 101 402 | 00:06:24,830 --> 00:06:30,310 403 | And if you pass in something that's not there, then you'll see an error code one thousand and two. 404 | 405 | 102 406 | 00:06:30,320 --> 00:06:34,830 407 | So you have standard error codes and you have some areas that you yourself can meet. 408 | 409 | 103 410 | 00:06:35,180 --> 00:06:36,590 411 | So let's try this someplace. 412 | 413 | 104 414 | 00:06:36,600 --> 00:06:39,570 415 | I'm going to try the first one where I'm getting Euro and USD. 416 | 417 | 105 418 | 00:06:39,600 --> 00:06:46,100 419 | I'm just going to copy this link, which they said that's how you get to the data on this end point 420 | 421 | 106 422 | 00:06:46,550 --> 00:06:52,460 423 | that I'm going to open up postman and then what I'm going to do is paste it inside of this. 424 | 425 | 107 426 | 00:06:52,490 --> 00:06:54,410 427 | It says, enter request euro. 428 | 429 | 108 430 | 00:06:54,410 --> 00:06:55,400 431 | That's what we just copied. 432 | 433 | 109 434 | 00:06:55,400 --> 00:06:55,850 435 | Right. 436 | 437 | 110 438 | 00:06:55,850 --> 00:06:57,490 439 | Request on the euro. 440 | 441 | 111 442 | 00:06:57,770 --> 00:07:05,270 443 | So I paste the request, your URL and then the verb here immobilising you can get post, you have put 444 | 445 | 112 446 | 00:07:05,270 --> 00:07:07,490 447 | Potch deletes, you have a bunch of them. 448 | 449 | 113 450 | 00:07:07,490 --> 00:07:11,350 451 | So get is usually used when you're expecting to retrieve data. 452 | 453 | 114 454 | 00:07:11,360 --> 00:07:11,770 455 | Right. 456 | 457 | 115 458 | 00:07:12,080 --> 00:07:18,260 459 | So it gets and then free for its API, whatever that request was. 460 | 461 | 116 462 | 00:07:18,420 --> 00:07:24,020 463 | No one's committed to memory because it's there in the documentation and then I will click send. 464 | 465 | 117 466 | 00:07:24,500 --> 00:07:27,540 467 | What Postman does is make a call. 468 | 469 | 118 470 | 00:07:27,590 --> 00:07:35,300 471 | Well not really make it actually performs the call to that API endpoint and then retrieve the data in 472 | 473 | 119 474 | 00:07:35,300 --> 00:07:36,110 475 | the response. 476 | 477 | 120 478 | 00:07:36,110 --> 00:07:42,410 479 | So we see here it may not be as well formatted as how it is in the documentation. 480 | 481 | 121 482 | 00:07:42,590 --> 00:07:47,270 483 | Of course they're putting their best foot forward, but is the same bit of information we're getting. 484 | 485 | 122 486 | 00:07:47,720 --> 00:07:48,410 487 | Right. 488 | 489 | 123 490 | 00:07:48,800 --> 00:07:53,240 491 | And we're getting a timestamp and we're getting a code of two hundred. 492 | 493 | 124 494 | 00:07:53,510 --> 00:07:56,690 495 | If you look to the right, you'll see the status. 496 | 497 | 125 498 | 00:07:56,690 --> 00:07:57,980 499 | Two hundred or so. 500 | 501 | 126 502 | 00:07:57,980 --> 00:08:01,810 503 | Two hundred is the universal response for all. 504 | 505 | 127 506 | 00:08:01,820 --> 00:08:05,260 507 | T once you get to the 200 response, you know, everything is OK. 508 | 509 | 128 510 | 00:08:05,510 --> 00:08:08,510 511 | So the different numbers have different meanings, of course. 512 | 513 | 129 514 | 00:08:08,520 --> 00:08:08,790 515 | Right. 516 | 517 | 130 518 | 00:08:09,230 --> 00:08:10,840 519 | The time it took to make the call. 520 | 521 | 131 522 | 00:08:10,850 --> 00:08:12,240 523 | So this is a quick API. 524 | 525 | 132 526 | 00:08:12,240 --> 00:08:17,800 527 | It took only that's what, half a second and the size of the response. 528 | 529 | 133 530 | 00:08:17,840 --> 00:08:18,190 531 | Right. 532 | 533 | 134 534 | 00:08:18,200 --> 00:08:24,500 535 | You can always formatted so this you can click pretty or you can see raw or prevue. 536 | 537 | 135 538 | 00:08:25,470 --> 00:08:29,350 539 | Or visualize, I'm not sure why pretty. 540 | 541 | 136 542 | 00:08:30,000 --> 00:08:32,340 543 | Oh, that's right, I have to change the format. 544 | 545 | 137 546 | 00:08:32,340 --> 00:08:33,890 547 | So it's pretty HMO. 548 | 549 | 138 550 | 00:08:33,930 --> 00:08:35,700 551 | So this is all good looking HMO. 552 | 553 | 139 554 | 00:08:35,730 --> 00:08:42,510 555 | But if I take this, I can say something like SML what it sounds like some said HMO. 556 | 557 | 140 558 | 00:08:42,630 --> 00:08:44,520 559 | Let me click Jason, which it is. 560 | 561 | 141 562 | 00:08:44,700 --> 00:08:45,630 563 | And there we go. 564 | 565 | 142 566 | 00:08:45,750 --> 00:08:46,980 567 | So now it's pretty. 568 | 569 | 143 570 | 00:08:46,980 --> 00:08:53,100 571 | Geosung So now it looks a bit more like it is being previewed in their documentation. 572 | 573 | 144 574 | 00:08:53,640 --> 00:09:00,290 575 | So Posman is very handy when you just want to test what the response will look like. 576 | 577 | 145 578 | 00:09:01,050 --> 00:09:04,270 579 | Jason is the most widely used response type. 580 | 581 | 146 582 | 00:09:05,040 --> 00:09:06,660 583 | Well, I'm seeing that loosely. 584 | 585 | 147 586 | 00:09:06,660 --> 00:09:14,650 587 | I like to use JSON responses, but the process alternative to that would be XML and well, you know, 588 | 589 | 148 590 | 00:09:15,450 --> 00:09:22,050 591 | once the data is being returned, the user expects and you've documented what they can expect, then 592 | 593 | 149 594 | 00:09:22,050 --> 00:09:27,430 595 | you you can feel confident that anybody can use their API when needed. 596 | 597 | 150 598 | 00:09:27,450 --> 00:09:34,380 599 | So Posman is going to come in handy as we go about developing our API and just want to validate that 600 | 601 | 151 602 | 00:09:34,590 --> 00:09:37,860 603 | the response is, look, the way we expect them to. 604 | --------------------------------------------------------------------------------