Check out a free preview of the full Production-Grade Angular course
The "Mock APIs Q&A" Lesson is part of the full, Production-Grade Angular course featured in this preview video. Here's what you'd learn in this lesson:
Lukas answers questions about the Nx console plugin in VS code, using Nest for a microservices architecture, and using the Prisma or the Hasura cloud to makes the use of GraphQL easier.
Transcript from the "Mock APIs Q&A" Lesson
[00:00:00]
>> There's also an extension right there, nx console. And that also has the choices for schematics that we can create. And I just found nest in there as well. That sounds nice.
>> The comment was that there's actually A plugin for VS code.It's also a standalone application for Nx console.
[00:00:24]
And what this allows you to do is to essentially from a visual kind of a UI standpoint. Go through and kind of select your options, and it generates it for you under the hood. So I do have this installed, you'll have to take my word for it but I recommend checking it out.
[00:00:39]
I've been doing everything from the command line because I can start to automate a lot of that. But this is a really good way to essentially have a visual interface on top of it. And, fortunately will take me way too long to figure out. What, surprised they didn't use screenshots, but you're just gonna have to trust us.
[00:01:05]
It's pretty cool, it's just click, click, click boom, and it does it for you. So this will be a micro segment in the workshop and next console. It's cool, thumbs up. In fact, I gave it a four and a half out of five stars on yelp. All right any more questions?
[00:01:28]
How does everybody feel about what like we've been going over today like, like this is like I'm pretty excited because we are right. At kind of like, parody with how I really develop. And so for me to be able to kind of share like, this is the stuff that I'm into that I'm doing every single day.
[00:01:48]
It's really, really exciting. And I love training new developers. I think it's really important and it's extremely gratifying in a different way. But the stuff that we're going over right now in this workshop, these are the things that I literally use like every single day. And some of this stuff like even within the last couple weeks, I'm like, I didn't know this existed.
[00:02:09]
And it's now part of my toolset with the goal. Of building better things faster
>> Is an established framework for microservices architecture. And if so, what are the microservices, the apps or leaves,
>> I do know that it supports micro services so we can just pull this up real quick.
[00:02:33]
So typically I tend to go more towards like, either graph qL or like serverless. And so if I'm gonna do this kind of one or the other, but with that said, I've actually really been into console hashey Corp console. Which is kind of a microservices mesh, and, that's what you would use it for.
[00:02:56]
So they have a whole section here about how to do this, and You could literally probably just save this in, run it and Now you've got my wheels turning,so the answer is nes js. So the comment was on just ringing everybody up, is nes js a good framework for micro services and are microservices, are they libs?
[00:03:34]
Are they apps, what are they? So the answer is one, nest is great for microservices. Apparently they put a lot of thought into it. In terms of the actual file structure. I'm not qualified to say because it's something I haven't actually done yet. So if anybody knows, feel free to jump in and kind of offer that or offer any clarification, I would certainly not turn that down.
[00:04:03]
And, but, I mean, this is really, really well documented. Thing that they've done here, so somebody give it a try. Let me know, so the question is, how do you use databases it nest was typically the configuration. It's like Mongo mongoose what is it? For me, I use type ORM.
[00:04:25]
And so I define my entities, and then you just define your database connector, and you just drop it in. So they, again in the documentation, it's really well documented. And I would say, if this was like a two-day workshop, and we were really just going to get into it.
[00:04:44]
The next logical extension because you'll notice that there's this progression of we're going from like, Hardcoding data then we're going into. JSON server, which is you just throw away when you're done, but then we're moving into like nest. If I were going to put it in a persistent data store, typically what I do for local development is I just use SQL Lite.
[00:05:05]
And so it's really easy to define your entities and type RM. Pointed to SQL lite, and it will just generate it. Now granted, I probably won't put this in production. But it is a way to actually create that persistent data store that from there you update your database connector and pointed to like RDS or something in the cloud.
[00:05:28]
Or I've even spun up Postgres in like a Docker image and pointed it to that. That's another very viable option. So it's really, really easy type RM with the database connector. Boom done, and you're good to go.
>> Someone said Prisma for graph qL Was the statement. So the statement was Prisma for graph qL 2020.
[00:05:52]
And my response to that is hasura for graph qL 2020. And if you haven't checked out hasura then you're welcome.. KE, if I was gonna do a graphical and point, I would just do it with Hospira. What HASA does is you say here's my database. Here's my Docker config, spin up a Docker image with Hospira it pointed to the database, and then it autogenerates your graph QL.
[00:06:26]
Endpoint for you done. And I'm just gonna let that sink in. In a single Docker file, you spin up hasura pointed to the database and your graph qL database or your graphical endpoint is done. So, the question is what platform do I use for serverless? If it's up to me, AWS Lambda, but it really depends on what the client is using.
[00:07:00]
So, you really have three major platforms in my opinion. And that's AWS, Azure and GCP and kind of that order. And so by my opinion, like AWS, which is like kind of the dominant market leader that I think has like 70% of the share you have Azure. Which is also very good.
[00:07:21]
They're doing a lot of really good stuff. In the open source community. And then you have kind of like GCP down at the bottom which, I like GCP, I use it. I specially love fire base, and all three of those have of a, like a server less function environment.
[00:07:39]
If I'm gonna do it, it's gonna be AWS lambda with probably I'm gonna try spinning it up with like Terraform. And that will be bad, and so that's even we have a comment about microservices. Typically, if I'm going to do kind of a standalone API endpoint, that I'm gonna do it in server list and that's gonna be bad.
[00:08:01]
So I'm gonna let Amazon or any cloud provider handle that orchestration if I can get away with it.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops