
Lesson Description
The "Wrapping Up" Lesson is part of the full, API Design in Node.js, v5 course featured in this preview video. Here's what you'd learn in this lesson:
Scott wraps up the course by suggesting further learning with tools like GraphQL, gRPC, serverless APIs, Web Sockets, Docker, and GitHub Actions. He recommends students continue experimenting, expanding on the API, and using it as a reference.
Transcript from the "Wrapping Up" Lesson
[00:00:00]
>> Scott Moss: So we got all of that, we talked about deploying to Render. We got the health checks going, all that's good, really all that's what's left that there's no question it's just. My suggestions on what to learn next because congrats, you know how to make APIs and Node now, believe it or not. This is most of what makes an API.
[00:00:20]
This is most of what makes an API. I would say. The other stuff beyond what I just taught you today and the stuff that I'm about to suggest it's just like organizational stuff like how you organize your routes and how you organize your Controllers and different optimizations and tricks around that but at its core it's all this further learning beyond REST APIs we have things like GraphQL. Highly recommend checking that out soon.
[00:00:40]
Highly recommend checking that out soon. So get a, get a, you know, get a feel of what we did today and be comfortable with that and then give GraphQL a shot. Just don't do it right now cause it is a doozy, I know we have some courses here because I specifically have taught some courses on GraphQL and because the spec GraphQL is actually pretty much the same, a lot of those courses still hold up even though the SDKs that I'm using might be outdated. The concept of GraphQL holds up pretty well today, even, you know, with the courses being a few years old, but I'll get that updated if folks are interested, but yeah, I would say check that out eventually.
[00:00:54]
The concept of GraphQL holds up pretty well today, even, you know, with the courses being a few years old, but I'll get that updated if folks are interested, but yeah, I would say check that out eventually. I think it's is a standard. It's here a lot of people use it in production. We use it at Netflix, it's a it's a good technology, it just doesn't solve every problem, but.
[00:01:09]
We use it at Netflix, it's a it's a good technology, it just doesn't solve every problem, but. One of the biggest problems it solves is like being able to query relational data and like getting back something from the server in the exact shape that you want it, and it promises to do that. It's basically like TypeScript for your API it's the best way I can describe it. So it's pretty good.
[00:01:26]
So it's pretty good. It's just a pain to set up. So I'll check that out. I know someone talked about earlier gRPC and Protocol buffs, so.
[00:01:42]
I know someone talked about earlier gRPC and Protocol buffs, so. You can check out gRPC, you can check out Proto buffs, it's just another Framework, it's made by Google. This is more like Enterprise stuff, super performance stuff, probably wouldn't be doing this like on a personal project unless you're doing like. Something that really required performance at a different level, because yeah, it's a little different you got these like these proto files that like register like you know these RPC end points and things like that so it's a little different but very efficient, bidirectional support Streaming support which is really good that's probably one of the biggest things and obviously it's type safe so, the big thing about it is that it's since binary doesn't send JSON so and it's just faster.
[00:01:57]
Something that really required performance at a different level, because yeah, it's a little different you got these like these proto files that like register like you know these RPC end points and things like that so it's a little different but very efficient, bidirectional support Streaming support which is really good that's probably one of the biggest things and obviously it's type safe so, the big thing about it is that it's since binary doesn't send JSON so and it's just faster. Service APIs, we built a traditional server that's always on. You should go check out some service APIs and how they work. Pretty easy.
[00:02:10]
Pretty easy. You pretty much just write the handler, so we wrote the handlers slash Controllers today but a service API is just the handlers and Controllers. There's nothing else. You just, you just do that and everything else is taken care of for you.
[00:02:26]
You just, you just do that and everything else is taken care of for you. There's no ports, there's no servers, there's nothing. You just write the Controllers and you're done, And it's pretty similar to what we did. There are some constraints like you can't do like database pooling and things like that and because it's not long-lived, so you have to reimplement everything from a service archi from service architecture so there are some constraints Edge Functions literally like serverless but on a CDN and even more constraints.
[00:02:37]
There are some constraints like you can't do like database pooling and things like that and because it's not long-lived, so you have to reimplement everything from a service archi from service architecture so there are some constraints Edge Functions literally like serverless but on a CDN and even more constraints. They actually don't run in Node, they run in something called a Web worker, which is a subset of JavaScript that is not the same as the JavaScript that's in a Browser. It's not the same as JavaScript that's in Node. It's a whole different subset.
[00:02:54]
It's a whole different subset. It is a very lightweight version of JavaScript and you can't really use most things that you would in Node, and definitely can't use most things that we use in a Browser. But you can do some really interesting stuff with Edge Functions, so I highly recommend checking that stuff out. Real time Web Sockets, so two-way communication bidirectional from a server to a client in both ways So think like a chat app, you're using iMessages and you see that typing indicator, those are Web Sockets, you know, you are.
[00:03:08]
Real time Web Sockets, so two-way communication bidirectional from a server to a client in both ways So think like a chat app, you're using iMessages and you see that typing indicator, those are Web Sockets, you know, you are. You know, seeing a dashboard updating in real time, it could be WebSockets. It might also be polling, but WebSockets is how you would do like a two-way communication where a server can broadcast out to a bunch of connected clients or just one Client, things like that. So, chat app is obviously.
[00:03:23]
So, chat app is obviously. The the poster child for Web Sockets is like you just got, you got a chat, you know, or like I guess in this case you got a. A push notification from your phone, that would be something like a Web socket, right? So you're being pushed some type of event versus having to ask for it like HTTP And if you're really serious you're looking at a little more DevOp stuff, you could look into containerization with like Docker and Kubernetes.
[00:03:38]
So you're being pushed some type of event versus having to ask for it like HTTP And if you're really serious you're looking at a little more DevOp stuff, you could look into containerization with like Docker and Kubernetes. So Kubernetes might be a little, yeah, I don't know unless you specialize in this, but I highly recommend everyone here learn Docker. It's not as intimidating as it looks. Highly recommend using it because a lot of deployment platforms can take a Docker file and just deploy it for you and if you're stuck on not knowing how to use it you're gonna miss out on a lot of different, experiences and opportunities and like with AI honestly it's super simple I learned Docker a few years ago and I wish I would have learned it sooner.
[00:03:53]
Highly recommend using it because a lot of deployment platforms can take a Docker file and just deploy it for you and if you're stuck on not knowing how to use it you're gonna miss out on a lot of different, experiences and opportunities and like with AI honestly it's super simple I learned Docker a few years ago and I wish I would have learned it sooner. It's not, it's not, it's not too crazy so I highly recommend learning that Kubernetes. I don't know that unless you're working on infrastructure, probably it's not that big of a deal, but if you already learned Docker and you liked it, maybe you'll like Kubernetes too, so I'll put that here. But try Docker first, Kuberneti's is different, Cool.
[00:04:09]
But try Docker first, Kuberneti's is different, Cool. And then I talked about GitHub actions a little bit, so if you wanna like automate workflows on different events like, hey, when someone push something to this main branch or wanna do a Pull Request to this branch, run this test job literally like honestly if you copy this and put it into a GitHub action on this repo, you'll get your test ran before render deploys. And that's it. Those are the things that I think you should continue learning.
[00:04:28]
Those are the things that I think you should continue learning. Another cool thing that you might wanna do is look at the notes that I left you with and implement some of that stuff. There's still some more stuff on the Controllers with the habits. There's a lot more tests.
[00:04:46]
There's a lot more tests. There's some things that you can expand on, you know, maybe add some more stuff to the API and the schema, maybe even build a GUI, build a mobile app in front of this, The AI agent that interacts with this API and tracks your habits for you with the with your voice like just experiment with it, and have fun it's your playground, you know, so use it there, reference it, Go back to it when you're working on things in your job, maybe you're doing Node JS and you're like oh how did I do that thing? Use this as a reference, go back and find something that. Connected with you or things like that because when I was learning a lot of this stuff it was mostly just me looking at other people's code and like how why did they do that?
[00:05:00]
Connected with you or things like that because when I was learning a lot of this stuff it was mostly just me looking at other people's code and like how why did they do that? What was their opinion here and I adopted their opinions first and then over time I started building my own opinions so it's just a quick way to learn and I'm not saying I have the best opinions I'm just saying it could be something that might unblock you to get you inspired to figure out something that works for you outside of what I did. It's just a non-blocking thing. So, yeah, and you have any questions?
[00:05:19]
So, yeah, and you have any questions? Anything for me? Yes. I have a dumb question.
[00:05:35]
I have a dumb question. No such thing. How do you get those cool little emojis in your ID? Oh, which ones?
[00:05:55]
Oh, which ones? Let's see. When you're typing strings, you put those little emojis. Oh, this?
[00:06:14]
Oh, this? Yeah, what is it? Oh, this is Raycast. You ever heard of Raycast?
[00:06:28]
You ever heard of Raycast? No. Oh, what? Oh my goodness.
[00:06:44]
Oh my goodness. Hold on, I'm about to save your life. It just came out for Windows recently. Oh yeah, they just came out from Windows too, yeah.
[00:06:56]
Oh yeah, they just came out from Windows too, yeah. So Raycast is like, You know, like, so I think they have this on Windows. If you hit is it Windows space or AltSpace, it brings up like a global command bar maybe, or maybe that's just Windows 11, depends on what version of Windows, but on Mac, if you hit command space, they bring up Finder or Spotlight. Raycast is a better version of that, so you can pretty much control your whole computer from this command bar and one of the things that it has is like this built in emoji selector.
[00:07:17]
Raycast is a better version of that, so you can pretty much control your whole computer from this command bar and one of the things that it has is like this built in emoji selector. That you can select emojis with and honestly you can do this without Raycast with the same shortcut on a Mac. I don't know how to do it on Windows, but on the Mac you can hit command control space and it would bring up the Mac version of this and not the Raycast version, but it's still there. So yeah, this is Raycast and yeah they did just come out or I guess they have like a waitlist for it on Windows, so highly recommend checking it out.
[00:07:34]
So yeah, this is Raycast and yeah they did just come out or I guess they have like a waitlist for it on Windows, so highly recommend checking it out. It's pretty cool, pretty cool project. Yeah. Yeah, any other questions?
[00:07:46]
Yeah, any other questions? Yeah. Yeah, I'm curious, does the choice of runtime matter like I know Bun, you mentioned Bun and you know, it's like. Would you recommend maybe considering?
[00:07:59]
Would you recommend maybe considering? Using a different runtime just for kicks. Yeah, good question. Does runtime matter?
[00:08:15]
Does runtime matter? There's different run times outside of node that are similar Deno, Bun, probably another one that I can't think of right now, Yes, I think it does matter. I mean, I prefer Bun actually. Bun is like my favorite.
[00:08:35]
Bun is like my favorite. I think the last course I taught I might have used Bun or I tried to at least. I don't remember, but I prefer Bun. I think it's great.
[00:08:52]
I think it's great. I decided not to use it because I didn't want, I didn't know what the future of Bun was gonna be and people watch this course later. Bun might just not be a thing. They're like a funded startup.
[00:09:07]
They're like a funded startup. That might die whereas Node is just like a collective of people doing this for free, so it's probably not gonna die. That's the main reason I chose Node otherwise I would have chose Bun and then also, you know, I think Bun does some really cool stuff. It's, I mean, it's definitely inspired Node JS to do some of the stuff they built in SQLite they built in TypeScript now, they've done a lot of enhancements to improve themselves, learning from what Bun did.
[00:09:22]
It's, I mean, it's definitely inspired Node JS to do some of the stuff they built in SQLite they built in TypeScript now, they've done a lot of enhancements to improve themselves, learning from what Bun did. So yeah, I think it does matter. Bun is also faster, Deno is more secure than all of them, so security is the thing you might wanna look into that. But what I can say as far as like compatibility, as far as like what's gonna accept.
[00:09:35]
But what I can say as far as like compatibility, as far as like what's gonna accept. Your deployments, it's Node, it's not even close like Bun. I'm sure they're calling everybody they can to be supported on every hosting provider that is out there but like Node has already done the work and it's already known. To be fair, a lot of these things are like interchangeable.
[00:09:51]
To be fair, a lot of these things are like interchangeable. Bun does a really good job of being interchangeable with Node, but it's not always 100% in my opinion Definitely ran into issues around like different modules not being able to install, like even like bcrypt and stuff like that. Sometimes you get issues. So for that reason I chose Node for the sake of teaching cause it's just safer, but if I know I'm gonna be someone that's gonna be deploying something and I'm managing it yeah, I'll live on the Edge a little bit and try Bun, so.
[00:10:11]
So for that reason I chose Node for the sake of teaching cause it's just safer, but if I know I'm gonna be someone that's gonna be deploying something and I'm managing it yeah, I'll live on the Edge a little bit and try Bun, so. Any other question? Yeah, so this is about migrations. If you were to do a migration, that's say you wanted to put in like later on in the development cycle, you wanted to put in a table that had like user preferences or something and see it with that, would that create another 0001 migration?
[00:10:22]
If you were to do a migration, that's say you wanted to put in like later on in the development cycle, you wanted to put in a table that had like user preferences or something and see it with that, would that create another 0001 migration? Yes, so if you the next, yeah, I mean, if you just run a migration again, like, I'll do just that, right? So. So if you want to make a new table.
[00:10:37]
So if you want to make a new table. You know, export const, user preferences. PG table user preferences. And we gave it, let's just say for now we just put an ID on here, just keep it simple.
[00:10:49]
And we gave it, let's just say for now we just put an ID on here, just keep it simple. So we did that, and then We wanted to Generate a migration, yeah, it's just gonna generate another one and just bump the number up, so, Yeah. Run DB Generate. So you see that and look, 0001, purple squadron sinister.
[00:11:05]
So you see that and look, 0001, purple squadron sinister. So it's that's, I don't know, it's I don't know where these names come from, but yeah, it just, it just incremented it by one, like I said, they don't think you're gonna do 10,000 migrations, so you only get 4 numbers, but there you Go, it just generate that next one and you're off to the races, but you would only do this. After you've done, you know, you've iterated on this problem, right, you tested it, you did all your pushes because if you're like, oh yeah, I gotta do this, oh wait, but I gotta add another field to this and you add another now you gonna make another migration for another field, and by the time you actually do your PR you got you like 30 files in here and it's like what are you doing? Why do you have 30 files for one table?
[00:11:23]
Why do you have 30 files for one table? Why didn't you just make one migration? You're like, oh well, I was figuring it out. Well, why didn't you wait till the end to do the migration?
[00:11:39]
Well, why didn't you wait till the end to do the migration? Well, I had to update my database. Well, why didn't you just do push? Oh, OK, yeah, I don't know, right?
[00:12:07]
Oh, OK, yeah, I don't know, right? So just don't do this until you're ready. The name that it comes with, can you change that or can you? Not to my knowledge, they have, I'm sure they have like a text data set and they just randomize it I don't think you can change it, but maybe I've never had to get that deep with it, but it is kind of funny.
[00:12:28]
Not to my knowledge, they have, I'm sure they have like a text data set and they just randomize it I don't think you can change it, but maybe I've never had to get that deep with it, but it is kind of funny. Cool. Any questions? Yeah, no worries.
[00:12:42]
Yeah, no worries. Any other questions for me? No. OK, if there's no other questions.
[00:12:58]
OK, if there's no other questions. I appreciate you all for coming out and learning with me because I definitely learned a lot as well and hopefully you all got what you're looking for out of this course and you feel a little more confident, if not a lot more confident in your ability to create APIs, not just in Node but just in general like I think Node JS is a really good tool to be like. It's a great tool to show like general concepts when it comes to software engineering where it's like creating UIs or APIs or even databases.
[00:13:07]
It's just so simple to work with, so hopefully you understand APIs in general a little more and then specifically with the Express and you kinda understand like where those patterns are coming from and where you might fit in and things you might optimize so hopefully you can take that with you on your next journey whether it's a job that you're currently working, your contract or personal projects and You know, if you get excited about something cool, you wanna ask me a question, hit me up, I'm always here, So thanks for coming
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops