WHAT ARE ENDPOINTS? How can you make them?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] I want to talk about endpoints and why they're so important I want to talk about how to make them and I'm going to be showing along the way the grind real API that I've been working on and why endpoints are so important the first thing is that endpoints are communication channels when you make a route that goes slash ice cream slash want that will bring you the first ice cream and if you change ice cream to beer / one it will give you the first beer those are two different micro-services that both do two different things that's the best thing about endpoints is you can make a giant API with a bunch of different routes a bunch of different endpoints and they can all do different things but they all work through the same application api's can be used for anything everything from tiny information like a name all the way to credit card transactions to code transaction to picture transactions everything that's being sent over the web can be sent to api's and the best thing about it like I talked to my last video about how you can structure your project is that you can make a server split up from the client and now you can add applications working on the same server you're not stuck into an MVP structure where everything's stuck to one and most endpoints work through HTTP or HTTPS which are two different methods you can use for talking over the Internet endpoints usually work in crud formation so create read update and delete create you want to create a ice cream in your ice cream database read you want to pull and read an ice cream from the ice cream database update you want to update information from an ice cream for an ice cream database and delete you want to delete an ice cream from the ice cream database now api's communicate through urls which is where the word routes come in so something like /i script / news / chocolate banana that would be a new ice cream called chocolate banana that's being created where you can or you can do a / ice cream / delete / one which will go delete the first ice cream in the database endpoints are always a channel to grab data whatever your application is based off of you're going to have endpoints if you're doing that specific structure where you can access certain information now when working with crud apps most of the time you're using the top four types of HTTP requests you have post which is sending information that's the create you have get which is getting information that's the read you have update or put which is the update of the crud and then you have the delete which is delete I'm going to show you guys what I've used in my API and that from there I can show you how I plan it so here in the console I'm making sure that my app is running and ready let's go into vyas code here we can see one of my basic endpoints if they go slash API slash get user slash key now this is considered restful routing slash API brings you to all the API features slash get users brings you to all the getting users features and then in this case just slash key will allow you to just get all the users because you're not giving a specific user ID like one two three or a huge number you're just going to straight to the endpoint and it returns everything to you I do have a syndication set up so I'll show you guys what that looks like but anyways this is the index endpoint when you go here it returns the string to you just like in the index position but if I were to try and go right here to this without a key it returns an error because I'm trying to access the API without a key which is where my authentication comes in but let's go right here and just write the word something which is a hard to coded key and give it a moment and there we go we get our users from the API now this is a read end point out of the crud this is a read I ask it to give me users I'm not affecting the database at all which happens to report or a post or a delete but but it get in this case what I'm using does not at all I repeat at all modify anything in the back end it is just for reading and that's it if you want to store how many times a person read that's one thing but if that's it for reading and reading only this is one tool I use called J s doc now depending on the language you're using it through the language name and then Doc's so Java doc c-sharp doc jst Ruby doc whatever you want usually you can find one that maps comments into documentation so here I have my authentication function I have some comments table in the code which I can pull up right here if I go to my main server file authentication function right here so this is what comments look like we'll check database for a key return a boolean it takes it a key and a returns a boolean we go here we click on this and we can see that it takes in a key takes in a key number authentication no I think I made a mistake about how I did the return but anyways this is the point you know great documentation here I got my my table with all my routes and all the information about them I got some user user stories down there and this is just a clean way of documenting your whole project you can throw this into your readme and you can make a website like a quick Google pages website out of this makes so much great documentation related projects so when you come back to it it's all clean and ready for you this is how I recommend to to make end points before you actually make the end points just plan out the database so make an ard and then plan out your end points of what you want you know out of your user stories you make you user stories like hey user needs to be able to get all the user names and then go make a end point for that and then go figure out database what a user would look like what their model looks like hope you guys enjoyed that's it for today tomorrow I want to try and come in with a day in the developer where I record my day at work and everything from the morning all the way tonight we'll see how that goes see you guys Internet [Music]
Info
Channel: Mikael Abehsera
Views: 23,603
Rating: undefined out of 5
Keywords:
Id: lE7obYznoyk
Channel Id: undefined
Length: 6min 55sec (415 seconds)
Published: Thu Mar 21 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.