Тёмный

Best way to create GraphQL API ?? | NestJS GraphQL Tutorial 

Marius Espejo
Подписаться 29 тыс.
Просмотров 80 тыс.
50% 1

In this video I walk you through how to create a new GraphQL server and API from scratch utilizing the NestJS framework. This is in my opinion one of the best ways to do it!
We'll also cover multiple topics including database integration with TypeORM, queries and mutations, validation, as well as some techniques to help you develop these as FAST as possible!
00:00 - Intro
00:47 - What we'll build
02:23 - PART I: Generate project
04:23 - Generate Pets module
05:27 - Code first vs Schema first
07:29 - GraphQL Module import
07:47 - Creating Pet Object Type
11:24 - Writing our first query within the resolver
14:18 - Testing our new query
15:32 - PART II: Database Integration
18:00 - Pet database entity
20:02 - Update PetsService to use database
22:13 - createPet implementation
24:41 - Writing an Input Type
26:46 - PART III: Mutations
30:35 - Validation setup
34:21 - Implement findOne query
37:28 - How to auto generate all the boilerplate
40:13 - Owner database entity
40:59 - Implementing Pet/Owner relationship
44:28 - Ability to add owner info along pet query
47:46 - Implementing query to get pet owner
52:19 - Conclusion
52:58 - Outro

Опубликовано:

 

5 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 246   
@mariusespejo
@mariusespejo 3 года назад
00:00​ - Intro 00:47​ - What we'll build 02:23​ - PART I: Generate project 04:23​ - Generate Pets module 05:27​ - Code first vs Schema first 07:29​ - GraphQL Module import 07:47​ - Creating Pet Object Type 11:24​ - Writing our first query within the resolver 14:18​ - Testing our new query 15:32​ - PART II: Database Integration 18:00​ - Pet database entity 20:02​ - Update PetsService to use database 22:13​ - createPet implementation 24:41​ - Writing an Input Type 26:46​ - PART III: Mutations 30:35​ - Validation setup 34:21​ - Implement findOne query 37:28​ - How to auto generate all the boilerplate 40:13​ - Owner database entity 40:59​ - Implementing Pet/Owner relationship 44:28​ - Ability to add owner info along pet query 47:46​ - Implementing query to get pet owner 52:19​ - Conclusion 52:58​ - Outro
@abolfazljalildoost766
@abolfazljalildoost766 Год назад
Everything you need to know about Nest exists in your channel. Amazing tutorials. Thank you
@kawthooleidevelopers
@kawthooleidevelopers 2 года назад
Thanks, Bro. Your tutorial has made my life easier trying to figure out how to implement GraphQL with NestJs.
@OmnispectiveHub
@OmnispectiveHub Год назад
Just started watching the video and you already cleared up some things for me in my mind. Can't wait to check out more of your content.
@SebastianSipos
@SebastianSipos Год назад
I'm glad it's comprehensive but on point with explanations.
@PauloTheDev
@PauloTheDev 3 года назад
Your walkthroughs are gold, thank you sir!
@Thorax232
@Thorax232 2 года назад
I'm coming into NestJS new for a GraphQL solution, this is a great quickie to get things off the ground, appreciate it.
@muratasarslan2359
@muratasarslan2359 2 года назад
Very useful, easy to follow along. Thanks. Looking forward to see more graphql content 😀
@luiseduardo2567
@luiseduardo2567 11 месяцев назад
Good content. Simple and straightforward but extremely accurate and informative. It's hard to find a guide to anything in programming without a lot of dodging these days.
@rickycoates3003
@rickycoates3003 Год назад
That pretty much all I ever wanted and needed to get start modifying pre-made projects using this amazing tech Thank you so much
@keyurpatel1980
@keyurpatel1980 Год назад
Hello Marius, Thank you very much for this great tutorial. The flow of the tutorial is so nice and easy to follow as well the way you introduce advanced scenario is really great. I admit this is the number one tutorial I have ever seen on RU-vid.
@mariusespejo
@mariusespejo Год назад
Thank you for your feedback, glad you found it helpful 🙂
@Holdino_
@Holdino_ 3 года назад
Awesome as always! Loving the Nextjs / TypeOrm content
@flogginga_dead_horse4022
@flogginga_dead_horse4022 3 года назад
nest, next is a whole other story lol
@user-fd2kd7rz9r
@user-fd2kd7rz9r 11 месяцев назад
Great tutorial. Pretty simple and chilly explenation of basics.
@aghileslounis
@aghileslounis 2 года назад
calm and collected, very good course ! looking forward for a more detailed and complete Nestjs course (paid why not) :) great job
@SpyingCraft
@SpyingCraft 2 года назад
lols ap karwalein paid :)
@jimknopf5558
@jimknopf5558 Год назад
I was a bit put off by the length of the video because I really just needed to brush up a bit. But I'm glad I watched it in its entirety. Thanks a lot, very nicely explained, helped me a lot!
@devcotv
@devcotv 10 месяцев назад
This is a great tutorial. Thank you so much for sharing it. It's really helpful for me, and I think it's also suitable for other people who are looking for more details on working with GraphQL + Nestjs. Thank you
@a.anvarbekov
@a.anvarbekov Год назад
Just finished. Loved your way of teaching, thanks brother
@sernguangtoh4141
@sernguangtoh4141 3 года назад
This tutorial is AWESOME !!! Thank you Marius.
@sandipbasnet5557
@sandipbasnet5557 3 года назад
I just want to say, thank you so mush for curating this amazing video.
@mariusespejo
@mariusespejo 3 года назад
no problem glad you found it useful!
@trung-tinpham2437
@trung-tinpham2437 2 года назад
Awesome man! There are lots of information. Thanks a lot ❤️
@iPururin
@iPururin 2 года назад
This is awesome content! Looking forward for more NestJS!!
@mariusespejo
@mariusespejo 2 года назад
More in the channel!
@Ari6n
@Ari6n Год назад
Marius, thank you for the video - it was very helpful! I'm just started learning NestJS, TypeScript and GraphQL concepts. And there you explained a lot. So your video worked as amazing starter boost for me :)
@mariusespejo
@mariusespejo Год назад
Glad it was helpful!
@goldy8963
@goldy8963 2 года назад
Good job ! It was very helpful ! Keep creating great content like this one
@mariusespejo
@mariusespejo 2 года назад
Thanks!!
@rajgohil8610
@rajgohil8610 2 года назад
i mean seriously brother you are a god level teacher everything you have explained is so straight forward... you explain every thing you are doing thank so much for this wonderful concept thank you so much , I hope you got many views and you grow faster thank you so much brother...
@mariusespejo
@mariusespejo 2 года назад
Thank you Raj 🙏 appreciate your support!!
@basitwahid3452
@basitwahid3452 2 года назад
Great video Bro! Thanks a lot, it was all explained very well and easy way you can't imagine how much its good for me thanks
@mariusespejo
@mariusespejo 2 года назад
Glad to help!
@hannasavostianova7155
@hannasavostianova7155 3 года назад
Awesome! Really helpful!!
@YOUdudex
@YOUdudex 3 года назад
Awesome tutorial subscribed and shared with friends, thanks!
@mariusespejo
@mariusespejo 3 года назад
Thank you! Appreciate the support
@dougkfarrell
@dougkfarrell 2 года назад
Really helpful, thanks for doing this!
@mariusespejo
@mariusespejo 2 года назад
No problem!
@djonkoful
@djonkoful 3 года назад
thanks for this journey. the content was useful and great for me
@mariusespejo
@mariusespejo 3 года назад
I’m glad you think so, thanks for stopping by to comment 🙏
@michaldoubek4686
@michaldoubek4686 3 года назад
Thank you, it inspired me, how to refactor one of my apps.
@viacheslavgurin9368
@viacheslavgurin9368 2 года назад
Cool and useful! Thanks!
@hasst9261
@hasst9261 3 месяца назад
Your channel is a godsend
@jonathasrr
@jonathasrr 2 года назад
Very good, thanks!
@artemivanychev2074
@artemivanychev2074 2 года назад
Nice video! Thx!
@baohoang5421
@baohoang5421 2 года назад
Pretty good! Keep it going sir!
@solanum1423
@solanum1423 3 года назад
great video and easy to understand! pretty nice for GraphQL beginners btw i wanna say nest cli is so strong
@mariusespejo
@mariusespejo 3 года назад
thanks James! I appreciate the feedback
@chambaderaphael8946
@chambaderaphael8946 Год назад
Perfect tutorial👍
@ViciuSRO
@ViciuSRO 2 месяца назад
amazing, still relevant in 2024! thanks mate!
@mariusespejo
@mariusespejo 2 месяца назад
Thanks! Good to know, I was thinking of maybe doing a refresh of this with current versions
@ViciuSRO
@ViciuSRO 2 месяца назад
@@mariusespejo will be amazing to include DataLoader topic as well
@wiiktor1393
@wiiktor1393 3 года назад
Great video man! Thanks a lot, it was all explained very well
@kfchotdog
@kfchotdog 3 года назад
Love your videos, keep it up m8.
@mariusespejo
@mariusespejo 3 года назад
thanks man, appreciate it
@MehdiMoshtaghi
@MehdiMoshtaghi 2 года назад
Thank you so much :)
2 года назад
Excelent tutorial
@elco7956
@elco7956 11 месяцев назад
Great video
@zackOverflow
@zackOverflow Год назад
It's Awesome 👍
@juststudying1019
@juststudying1019 3 года назад
Thanks amazing content 👌
@AriaBelleMusic
@AriaBelleMusic 3 года назад
Thanks brad marius, Husay!
@ademmohammed3939
@ademmohammed3939 2 года назад
Thankyou for the tutorial. Very helpful. I was wondering if you could share the repository of the code in the video, it would be much more impactful.
@ronaldemanuel6557
@ronaldemanuel6557 2 года назад
Nice tutorial
@pareshmaniyar8273
@pareshmaniyar8273 2 года назад
Amazing!
@mariusespejo
@mariusespejo 2 года назад
Thanks!
@mohamedabdulla8097
@mohamedabdulla8097 4 месяца назад
great man
@teknolovedigital
@teknolovedigital Год назад
You are the master of nestjs on youtube
@mariusespejo
@mariusespejo Год назад
Nah, lots of great content creators out there haha but I do hope that people are subscribing based on my teaching style
@prateekrajput2646
@prateekrajput2646 5 месяцев назад
you got a new sub
@kimhyungchae
@kimhyungchae 3 года назад
코딩 잘하네요👍
@joecolas
@joecolas 2 года назад
this is great
@user-dw8lb8lc7u
@user-dw8lb8lc7u 3 года назад
Гигант мысли, In this video i find answers on all questions
@afsarzan
@afsarzan 2 года назад
Thank you Marius
@mariusespejo
@mariusespejo 2 года назад
You’re welcome!
@Martijncvv
@Martijncvv Год назад
Thanks sir! Would happily pay for some more advanced NestJS courses
@mariusespejo
@mariusespejo Год назад
Thanks for the thought! I have been thinking about putting something together
@tahsinxeelani3107
@tahsinxeelani3107 2 года назад
your subscribers should be wayyy up man.
@mariusespejo
@mariusespejo 2 года назад
Thanks 😄 still growing! Just takes time.. hope you’re one of them!!
@francamaj3551
@francamaj3551 2 года назад
Does anyone has issue with starting app ? It shows error 'ReferenceError: globalThis is not defined'... something related to graphql-tools ??
@TheWalrus_45
@TheWalrus_45 2 года назад
Whats up Marius! There has been big changes in NestJS GraphQL. The GraphQL library is now a plugin which means you can use Mercurius instead of Apollo. What makes this really exciting is that just a few hours ago an update was merged that allows Mercurius subscriptions with federation! Something that is not possible with Apollo.
@mariusespejo
@mariusespejo 2 года назад
Interesting thanks for the heads up, I might make a newer follow up to this video, it’s getting a bit dated lol
@pyakz6474
@pyakz6474 2 года назад
Nice
@user-tw3dy3jd9u
@user-tw3dy3jd9u 3 года назад
Better than any one in udemy 👍 plus, it's free
@3rg1s
@3rg1s 3 года назад
Hello Marius, thanks for the great tutorials. What do you use to create that sparkling effect when typing on your terminal?
@mariusespejo
@mariusespejo 3 года назад
thanks! it’s the hyper terminal and it’s just one of the default plugins for it
@vasylms2459
@vasylms2459 Год назад
Thanks
@tawhidsultan688
@tawhidsultan688 2 года назад
Can you share the repo Link of this demo project ? It can be helpful
@oldo-nicho
@oldo-nicho 2 года назад
Epic video, thanks so much! Is there any way to use the entity model when creating the input type? Sort of like in Typescript you can do Pick, or Omit? There seems to be a doubling up of declaring the fields in the entity and input type that is not so DRY.
@mariusespejo
@mariusespejo 2 года назад
Yup there’s support for something like that, take a look at mapped types: docs.nestjs.com/graphql/mapped-types But also something to think about, while there is some duplication, the input type and the entity have somewhat different concerns, e.g. the input types can be utilized for validation
@oldo-nicho
@oldo-nicho 2 года назад
@@mariusespejo thanks! Will take a look
@jhoannydiaz
@jhoannydiaz 3 года назад
Hi Marius, great video! Does it still need 'graphql-tool' as dependency? I don't see it in the list of dependencies anymore in the official documentation of NestJs.
@mariusespejo
@mariusespejo 3 года назад
That dependency doesn’t ring a bell to me and perhaps I am misremembering but I don’t remember mentioning that in my video here. Anyways I would assume that the official docs is the source of truth, if it’s not mentioned there then I would assume no
@rajatgupta6409
@rajatgupta6409 2 года назад
@Marius, Thanks for the great content. I have a query regarding Microservice Architecture with GraphQL API Gateway. The question is. How would i communication from GraphQL API Gateway to my service (HTTP or Message Queue) and how Service 1 would communicate with Service 2 (HTTP or Message Queue). Which one is the preferred way ? (HTTP or Message Queue).
@mariusespejo
@mariusespejo 2 года назад
I mean what your transport layer is between services or how you do it is up to you based on your own requirements I’m not sure I can answer that for you. Nest however has support for both request-response and event-based models, which should cover most typical use cases… e.g. I would imagine your queues by design won’t respond right away so communication via events probably makes sense
@sabianhhxevolution
@sabianhhxevolution Год назад
How do you get that animation on your cursor in terminal?
@briangitego
@briangitego 9 месяцев назад
Anyone know what that extension in the terminal is?
@lil_k_x
@lil_k_x 2 года назад
Thank you for example. I would like to know how did you Update and Delete data using Graphql ? I can't see any example here. Did I miss them ?
@mariusespejo
@mariusespejo 2 года назад
You would use mutations to provide that intent, then it’s up to your resolvers how the update/delete is performed
@anton_ivanov52
@anton_ivanov52 2 года назад
offtop question: @Marius what MacOs Terminal plugins or app do you use? looks awesome!
@mariusespejo
@mariusespejo 2 года назад
In my older videos (probably like this one) I messed around with hyper, which is a hackable terminal. Nowadays I mostly keep it simple with iTerm2 and oh-my-zsh with auto complete and syntax highlighting
@emiremark2889
@emiremark2889 28 дней назад
really good tutorial. do you have a sample for pagination ?
@mariusespejo
@mariusespejo 21 день назад
Thanks! I don’t think so I do but I recommend first understanding the different approaches outlined here: graphql.org/learn/pagination/ Then depending on the approach you take, setting up the inputs to map to whatever your database requires, e.g. take/offset
@tanvirraj
@tanvirraj 3 года назад
@Marius can you share the github repo for this code ?
@lancelim1951
@lancelim1951 2 года назад
Hi there! I'd like to ask a question regarding the @Args in getPets query. The @Args states that it is taking in an 'id' of type Int but it seems there is a second declaration of id:number? Why is that so? Thank you in advance!
@mariusespejo
@mariusespejo 2 года назад
The Int is representation of the Scalar type for graphql. In javascript there isn’t really an “integer” type only number, so we’re basically saying that Int scalar in the graphql model maps to a number type in javascript. Hope that helps!
@ganesh88maddy
@ganesh88maddy 2 года назад
Can anyone post Mutation updateOwner code for Owner Resolver and Owner Service.
@wiseman9960
@wiseman9960 Год назад
@Marius what is your Vscode theme? I like it
@kelvinkwong6365
@kelvinkwong6365 2 года назад
helo, this is a good video to get start on nestjs with graphql, when i keep move on, i try to do pagination in query. is there any tutorial can know more on it?
@mariusespejo
@mariusespejo 2 года назад
I don’t think I have one myself but it really mostly requires two things: one is you need to know how to do pagination with your ORM/database, for example with typeorm you can use limit/offset properties in queries. Two is you need to know how to add additional params to your graphql query request (basically inputs) which I believe I did cover in this video. You would basically need to have inputs for page/limit and feed that into the ORM query limit/offset
@malamhari_
@malamhari_ 11 месяцев назад
Hello, I'm struggling to customize response error/success when using nest-graphql do you have some resources/videos I can learn from?
@mariusespejo
@mariusespejo 11 месяцев назад
You need to throw http exceptions from nest, and those should be automatically caught & converted to apollo exceptions Look here github.com/nestjs/graphql/pull/1292
@krishnamandava9919
@krishnamandava9919 2 года назад
Great one. but I have confusion about @ResolveField() decorater can please explain this decorater
@mariusespejo
@mariusespejo 2 года назад
It’s meant to resolve a nested field, e.g. if you had a resolver for books, within that you might have the ability to resolve the author of each book
@julesruzindana-rukundo6254
@julesruzindana-rukundo6254 2 месяца назад
hi mate thanks for your very informative videos do you have any idea if i can upload/download images using a dockerized nestjs application with graphql.i cant find any resource online to help me.will my images be uploaded in the container?Thanks in advance.
@mariusespejo
@mariusespejo 2 месяца назад
You first need to understand the different approaches, then decide on where to store it, e.g. in a dedicated storage something like s3 and not in your container I recommend spend some time reading about it wundergraph.com/blog/graphql_file_uploads_evaluating_the_5_most_common_approaches
@MultiShokk69
@MultiShokk69 2 года назад
Nice video like always, thank you ! For the guys who have this error with findOne(id), it doesn't work anymore, it's findOne({where: {id:id}}
@mariusespejo
@mariusespejo 2 года назад
Thanks! Yeah that syntax changed slightly in typeorm 0.3
@PyroFire-Firework_is_a_passion
@PyroFire-Firework_is_a_passion 2 года назад
Great tutorial, but I'm running into a "Circular dependency" error when implementing the { owner: pets {...} } query.
@herberthenrique3898
@herberthenrique3898 2 года назад
I have the same problem
@stuartclove
@stuartclove 2 года назад
Thank you for this Marius. I've always done a very bare-bones setup with GraphQL and Node and was looking for something that could help give some structure and architecture to the APIs I build. This is phenomenal. I built the API along with you, but I couldn't get the "of => Pet" and "returns => Pet" to stop barking about the "of" keyword and "returns" keyword. It wouldn't work until I left them blank "() => Pet". Is that something new in the framework? If not, how do you get those to work? I can't find an answer anywhere on Google. Thanks in advance.
@mariusespejo
@mariusespejo 2 года назад
Hey Stuart, that’s how it is documented to be done in the docs today (having the of/returns), however since you don’t actually do anything with that parameter it shouldn’t hurt to do it your way.. I have a feeling though that you might be importing the decorators from the wrong place though. For example make sure you’re importing Query from ‘@nestjs/graphql’ NOT nestjs/common Which also exports a Query decorator for REST controllers. Otherwise it could also be that the type definition has changed since this video and the docs could be out of date
@atg1203
@atg1203 2 года назад
I had the same issue but I figured that it was an eslint warning
@huyle89201
@huyle89201 Год назад
anyone help me how to implement logic code at 52:19 ?
@TigCeX
@TigCeX 3 года назад
Is it ok to use connection from typeorm inside constructor of another service to avoid circular dependency and get to repository? Something like this.ownersRepository = connection.getRepository(Owner) inside pet service.
@mariusespejo
@mariusespejo 3 года назад
yes, but I personally have mostly never had to do that. An alternative would be using TypeormModule.forFeature([Owner]) in the module that you’re having the circular Nest also has some ways to prevent issues with circular dependency: docs.nestjs.com/fundamentals/circular-dependency
@TigCeX
@TigCeX 3 года назад
@@mariusespejo Ok, thanks for an answer!
@ajitsutar5132
@ajitsutar5132 3 года назад
Nice info👍 if you possible to upload MySQL connection and crate Curd application in nest js
@mariusespejo
@mariusespejo 3 года назад
thanks! It’s honestly the same exact code. The only difference would be to install the mysql driver instead of sqlite. You can actually see an example of that connection object in the nestjs docs here: docs.nestjs.com/techniques/database There is also more info on the mysql2 driver docs itself: www.npmjs.com/package/mysql2 The rest of the code shown in this tutorial is still relevant. hope that helps!
@erroledricdee7769
@erroledricdee7769 3 года назад
In your example you were able to show the owner data when querying for a pet. How do you implement this for the other way around? I tried exporting PetsModule and importing in OwnersModule to do a Pet search via OwnerId via PetsService but I got a "A circular dependency between modules." error.
@mariusespejo
@mariusespejo 3 года назад
Nest has docs on how to deal with circular dependencies: docs.nestjs.com/fundamentals/circular-dependency The other alternative is to simply add the other entity to the module, for example if you had: “TypeOrmModule.forFeature( [ Owner, Pet ])” in your module, then the service within that module can inject the repository for both entities without relying on a module dependency. Although in theory if you were utilizing relations properly (for example with the find API) I don’t think you even need to do any of that, e.g. you should be able to do something like: this.ownersRepo.find({ relations: [‘pets’] }); // returns owners with their pets That should work if all you need is to read/join the relation. I believe that’s covered in my video here
@mariusespejo
@mariusespejo 3 года назад
Actually I misspoke, not in this video but, I have another video in my channel specifically on TypeOrm relations which covers that topic in detail. Maybe check that out
@mariusespejo
@mariusespejo 3 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-rKgZLVgdvAY.html
@erroledricdee7769
@erroledricdee7769 3 года назад
Is there a way to generate Swagger documentation off GraphQL Schema? If yes, can you create a tutorial for this? Awesome tutorial by the way!!
@mariusespejo
@mariusespejo 3 года назад
Thanks! You wouldn’t really typically use swagger for graphql, instead you’d use something specifically designed for graphql like the playground. You need something that allows you to explore the schema, as a form of documentation, and I don’t think swagger would be good for that purpose. It’s more for traditional rest APIs where you’d instead explore endpoints rather than one big schema
@user-wv7vx6us3x
@user-wv7vx6us3x 2 года назад
If anybody getting error on 'npm start:dev', you should install 'graphql@^15' graphql version 16 does not work for this tutorial! Thank you for this video Espejo!
@mariusespejo
@mariusespejo 2 года назад
Yup, you can track the update required to allow v16 here: github.com/nestjs/graphql/pull/1834
@wealthifyme9738
@wealthifyme9738 2 года назад
thanks for saving the day!
@DevNiklesh
@DevNiklesh 3 года назад
Great content.. loving all of your videos.. I'm getting "Nest cannot resolve the PetsRepository" error when I implement to query pets from owner. Can you help me resolve this?
@mariusespejo
@mariusespejo 3 года назад
thanks! typically Nest not being able to find a repository is the result of forgetting to add TypeormModule.forFeature([Pet]) in the imports of the module where you’re trying to use the repo
@mariusespejo
@mariusespejo 3 года назад
I also just made a recent vid covering relations in typeorm if you want to check that out. Might make it more clear how to make that owner to pet querying work
@user-ob2in7tt7y
@user-ob2in7tt7y 3 месяца назад
at 15 min video you are running a video for pets query but you have not imported GraphQLModule in app module
@CJMFitnessJourney
@CJMFitnessJourney 2 года назад
Can you please create video how someone can protect graphql query based on my certain user role/permission? . Like a user with a role can only query but not create. It was very simple to do with REST api using Guards.
@mariusespejo
@mariusespejo 2 года назад
It should be mostly the same in graphql, couldn’t you simply add guards to your resolver methods?
@CJMFitnessJourney
@CJMFitnessJourney 2 года назад
@@mariusespejo I tried, but I wasn't able to get custom metadata from reflector. It was being undefined. But anyway I got it another way by creating global middleware and conditional checking req.body.operationName :)
@mariusespejo
@mariusespejo 2 года назад
Could maybe be an issue with how you’re registering your guard? The reflector usually should be injected automatically, but anyways I haven’t tried with graphql will give it a shot sometime
@iUmerFarooq
@iUmerFarooq 3 месяца назад
Awesome tutorial 🔥 Make Nestjs course for beginner to advance in 2024 tutorial and also on the same topic 💚 Thanks a lot
@mariusespejo
@mariusespejo 3 месяца назад
Thank you, yes hoping to produce more
@iUmerFarooq
@iUmerFarooq 3 месяца назад
@@mariusespejo Make tutorial on Nestjs guard I know what is guard but I don't know how to implement that in practical projects. I am actually learning Nestjs for the first time.
@mariusespejo
@mariusespejo 3 месяца назад
I did, if you look in the channel I have videos about nestjs authentication and authorization, which is what you would use guards for
@iUmerFarooq
@iUmerFarooq 3 месяца назад
@@mariusespejo ok ok please answer my last question. How much Nestjs should I know to do job. I am already doing job in database mssql related so I am learning NodeJs/Nestjs I just want to know how to make restapi with validation. What more should I learn. I am actually confused is what kind of projects I will build, and how it is used in market like I will making authentication and authorization Al the time or making api most of the time. I hope you understand.
@mariusespejo
@mariusespejo 3 месяца назад
Not a simple answer, because every job is different. However generally you need to have backend development fundamentals.. Nest is just a tool to help with that. Understand how to create basic REST APIs and how to do CRUD with a database… that is pretty much the main thing. Beyond that depending on your job there maybe other skills like validating requests, auth and maintaining user sessions, working with files (e.g. download/upload), caching, scaling & performance, security, etc.. However most of those things you can also learn on the job, as needed
@dariusdbbowser6329
@dariusdbbowser6329 3 года назад
hey great tutorial, I followed and everything worked until the end. Instead of pets, I changed it to planets and instead of owners, I changed it to factions...but everything else is the same. Getting an error code that says, " Entity metadata for Planets#faction was not found. Check if you specified a correct entity object and if it's connected in the connection options." Uploading it to Github anyway lol
@mariusespejo
@mariusespejo 3 года назад
I would suggest double checking your ormconfig, specifically the entities property. Make sure you have the right string there which is able to find all your entities
@emreaka3965
@emreaka3965 Год назад
Do we need circular dependencies? Isn't it something we should avoid? I mean if you also would like to query owners with their pets, we have to have a circular dependency. Owner service needs pet service and pet service needs owner service, right?
@mariusespejo
@mariusespejo Год назад
If you can avoid it you probably should, but like you mention there are cases where you can’t avoid it when the relationships of your data are naturally circular. There is a documented way to resolve this in Nest, see: docs.nestjs.com/fundamentals/circular-dependency
@mohabedr5030
@mohabedr5030 2 года назад
why you inject repository you can direct import Owner and do Owner.create(...) also after it you can do Owner.save(x) or direct do x.save()
@mariusespejo
@mariusespejo 2 года назад
I suggest reading about Data Mapper vs Active Record patterns, in Nest specifically it is recommended to use Data Mapper with the repositories
@cruzergo
@cruzergo 2 года назад
How can you use or Have you used MongoDB in NestJS and GraphQL using TypeORM?
@mariusespejo
@mariusespejo 2 года назад
Typeorm does have some mongo support, check out the docs. You can also use mongoose with nest
@cruzergo
@cruzergo 2 года назад
@@mariusespejo I am more interested in using Typeorm than mongoose. Will let you know how that goes.
@kennethkum187
@kennethkum187 3 года назад
Thanks for the video. Please i know you have a video on nestJs authentication, is it possible to use that same authentication in graphql. if yes please make a video to demonstrate how to do authentication in the graphql code and in the playqround. If not then please would really love to have a video about authentication in graphql API.
@mariusespejo
@mariusespejo 3 года назад
so the general idea of guards in nest is still usable in the graphql landscape so yes most of those same fundamentals would apply, you likely will just need to make a slightly customized AuthGuard which utilizes the graphql execution context. Maybe that gives you some direction for now but anyways I’ll definitely consider making a follow up vid. to further illustrate that. Thanks for the suggestion!
@kennethkum187
@kennethkum187 3 года назад
@@mariusespejo Thanks for the hint.
@mariusespejo
@mariusespejo 2 года назад
fyi just published a new video specifically on auth with graphql, if it's not too late for ya
@NathanielBabalola
@NathanielBabalola 3 года назад
I'm about to quickly learn GraphQL for a project, is this video a good for a beginner, and also I'm used to Express.js does learning GraphQL mean I have to learn another framework?
@mariusespejo
@mariusespejo 3 года назад
this is specifically for doing graphql with nest. I don’t necessarily explain graphql in detail in this video. I would suggest you start at the official graphql docs: graphql.org/learn/ then maybe look into some basic tutorials for your framework of choice (e.g express): www.howtographql.com
@mariusespejo
@mariusespejo 3 года назад
think of graphql as sort an alternative to REST. You can use it with any framework that can support it. That includes express. But depending on your needs or preferences it could be that a different framework might be better for you, it really depends
@NathanielBabalola
@NathanielBabalola 3 года назад
@@mariusespejo thanks for this, guess I'll go to the official docs to get started
Далее
Fastest Way to Create APIs? | NestJS Tutorial
27:49
Просмотров 34 тыс.
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
TypeORM v0.3.x Migrations, queries, with NestJS!
28:37
Learn GraphQL in 4 Hours - From Beginner to Expert
3:55:14
TypeORM Relations Tutorial - FULL details!
49:02
Просмотров 88 тыс.
The Hidden Cost Of GraphQL And NodeJS
28:35
Просмотров 187 тыс.
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21