Transcript
00:00 Sometimes you need to have some routes that are just there to serve data or to send some kind of response like a CSV or generated PDF or all kinds of things you can do all sorts of things with HTTP and It's not just UI that you want to serve on HTTP. You're not just wanting to send
00:19 HTML and JavaScript and those static assets. Sometimes you want to dynamically generate some assets And so for what we're going to do is we're going to add what's called a health check endpoint to our application A health check endpoint is basically just a endpoint that you can have some automated system check every now and then to say
00:37 Hey application, are you still running healthy? And those types of endpoints will typically check a couple of systems Whatever you're integrating with and then return some status that says well these things are healthy But a couple things are in a warning state or whatever like that It's taking too long to get a response from that API, whatever and this is used for
00:57 Metrics, it's also used during the deploy process. So as the Application is getting booted up the deploy system will check. Hey, are you ready? Are you ready? Are you ready? And it'll wait until that health check endpoint says, yeah, I'm all good. And so that's what this Okay, it signifies here on our health check is we want to have a simple
01:16 Loader which we will get into in the next exercise, but we're going to get a little intro right here We're going to have a loader which is a special Route or a special feature of a route that allows you to handle network requests specifically for
01:35 Either fetch requests or document requests and in our case because it's a resource route We'll be able to send back whatever we want to and we'll just send back Okay, but in these health check endpoints You typically are checking a bunch of different systems and then sending back the status of those things And again, this is mostly for automation
01:55 Processes not like a status page. Although you probably could use resource routes to build one of those So the idea here what you're going to be doing is creating a resource route so that we can verify the health of our system Small though it may be at this point and then we'll be able to add on to that in the future
02:15 This loader is going to be a lot simpler than you might think like way simpler than you might think because we don't actually have Any systems that we're checking so it's sufficient for us to know that if I can hit this endpoint and it gives me a 200 Response that we're good to go But having this established will help us in the future and on top of that
02:33 This is an important part of routing in web apps is being able to route these API routes or these routes that can generate stuff for us And so we are going to be learning about that right now. So have a good time and we'll see you when you're done