NestJS CRUD API with PostgreSQL for Beginners | LinkedIn Clone [1]

  Рет қаралды 66,189

Jon Peppinck

Jon Peppinck

Күн бұрын

This video shows how to create a properly structured RESTful API. A database connection is made to PostgreSQL. TypeORM is used to help perform all of the CRUD operations for our end points. This video is the first in an ongoing series to create a LinkedIn Clone using Ionic, Angular, NestJS, and PostGreSQL.
--------------------------------------------------
Recommended Udemy courses
--------------------------------------------------
NestJS - Zero to Hero: tinyurl.com/3r...
Angular - The Complete Guide: tinyurl.com/4h...
Understanding TypeScript: tinyurl.com/9w...
React - The Complete Guide: tinyurl.com/2t...
Docker Mastery (with Kubernetes + Swarm): tinyurl.com/ye...
Playlist: • LinkedIn Clone - Ionic...
GitHub: github.com/Jon...

Пікірлер: 81
@JonPeppinck
@JonPeppinck 3 жыл бұрын
-------------------------------------------------- Recommended Udemy courses -------------------------------------------------- NestJS - Zero to Hero: tinyurl.com/3rxsz669 Angular - The Complete Guide: tinyurl.com/4h5rmpsj
@michaelmelton6846
@michaelmelton6846 3 жыл бұрын
Great start to a series! I'm a React developer myself, but certainly looking forward to going through the rest of the NestJS series here!
@JonPeppinck
@JonPeppinck 3 жыл бұрын
Thanks Michael! I've tried my best to separate the NestJS and Angular code into their own videos, so perhaps it would be fun to make a React front end for the clone. Enjoy :)
@darshanbhut6714
@darshanbhut6714 2 жыл бұрын
Great Tutorial..but have one doubt on, if we want add one more column to entity afterwards then is there any migration scripts we have to generate for postgresql?
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Hi Darshan, that is a great question. Sorry for the slow reply. Have you had a chance to investigate further? The way this project is set up, we configure the TypeORM module in app.module to auto load entities and syncronize. This makes things smooth for development purposes, without the need to do migrations. However, you shouldn't syncronize in production as there is a risk to lose your data. I would suggest that in addition to backing up your database - spend some time to confgire this properly. I am under the impression this isn't too difficult. One can adjust the TypeORM config properties to have migrations via specifying the folder in which you wish to have them in. It has been some time since I've looked at this project tbh and didn't deploy it. Have you deployed any NestJS applications? Curious to see if/how you have dealt with this issue. Cheers!
@TheWalrus_45
@TheWalrus_45 3 жыл бұрын
Hi Jon, why did you choose to return an Observable instead of a Promise? When should I change my Promises to Observables in my own code? Thanks!
@JonPeppinck
@JonPeppinck 3 жыл бұрын
Hey Paul, I chose to use observables mainly because they are more powerful than promises. In this particular video it may seem like extra work but as we build up the application in subsequent videos we use RxJS to change the form of observables through the pipeable operators, which makes it easier to manipulate asynchronous responses. There is no 'should' here. If you are able to do what you want with promises feel free to use them. Like Angular, NestJS comes with RxJS and TypeScript, and even though you can write your code without type safety or observables, my opinion is you may as well use the extra power of the libraries provided. I also try and keep the codebase as consistent as possible so if an architectural decision to use observables is made, I try and stick to that guideline. I do recognise that it might not be possible in 100% of cases to stick to the guidelines, particularly with third party libraries, but still, making an effort to have a clean, organised codebase pays dividends on large projects.
@PaulPetersVids
@PaulPetersVids Жыл бұрын
21:54
@ahmadraid4214
@ahmadraid4214 Жыл бұрын
Can you tell me whats the extension you use to import function please
@JonPeppinck
@JonPeppinck Жыл бұрын
There is an extension called 'Auto import' - steoates
@JonPeppinck
@JonPeppinck Жыл бұрын
and JavaScript (ES6) code snippets by charalampos karypidis
@soft.developer
@soft.developer 10 ай бұрын
Thanks bro. that video helped a lot. I 'm a c# junior developer in the company i work in Brazil, but they asked me to implement a project with NestJs and u video was Very helpul. Thanks for the amazing tutorial.
@JonPeppinck
@JonPeppinck 10 ай бұрын
Thanks so much, glad it was helpful!
@Marco-ef5yk
@Marco-ef5yk 3 жыл бұрын
Hi Jon, one question pls. Why you are preferring using DTO in form of interfaces instead of classes as recommended in the documentation. Maybe I am missing something?
@JonPeppinck
@JonPeppinck 3 жыл бұрын
Hi Marco, great attention to detail. No real reason other than keeping the codebase consistent with my Angular code. I did read the documentation (controllers > request payloads) and it says you can use interfaces or classes - although classes are preferred. I do admit, it probably would be better to use a class, particularly if you are going to be using pipes at runtime. The good news is the change is quite trivial to make if desired. Thanks!
@Marco-ef5yk
@Marco-ef5yk 3 жыл бұрын
@@JonPeppinck And I guess is not possible to use DTO in form of Classes in Angularjs right? Never used Angular before :) Thank you very much for the responses!
@SuperEbine
@SuperEbine Жыл бұрын
Great mind , like to break things into simplest form. It really helpful as a beginner
@JonPeppinck
@JonPeppinck Жыл бұрын
Thanks so much!
@pabloroque8268
@pabloroque8268 2 жыл бұрын
Hi Jon, great video, but one recommendation, please use more zoom in the screen, because the letter is hard to read. Thanks for the video, im suscribe now.
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Thanks so much for subscribing Pablo. I appreciate your constructive feedback. I'll be sure to increase the size and also quality in general for my upcoming videos. I'm also going to get a new microphone so I hope that helps too - but may be a couple of months. Cheers!
@Travellife8877
@Travellife8877 2 жыл бұрын
great video to understand the full flow of this framework.
@JonPeppinck
@JonPeppinck Жыл бұрын
Thanks so much!
@信者の男
@信者の男 2 жыл бұрын
Just one question, why did you choose call it feed instead post? You are just handling posts so far.
@JonPeppinck
@JonPeppinck 2 жыл бұрын
I logged into my LinkedIn account before making the clone and saw that they use /feed and chose that pre-emptively. Of course you can call it whatever you want if you feel like post is a better name.
@chanybing40
@chanybing40 3 жыл бұрын
Incredibly helpful. I love that you actually explain everything. thank you so much!
@JonPeppinck
@JonPeppinck 3 жыл бұрын
Thanks so much! glad it helped!
@nguyenkien5558
@nguyenkien5558 2 жыл бұрын
Greate video again. However, could you make a video that explains using RxJS and some of its common api such from(), pipe(), switchMap(), etc?
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Thanks! I do have a small playlist on RxJS if you are interested which covers the fundamentals. Those methods you listed tend to be the ones used most heavily in this course.
@nguyenkien5558
@nguyenkien5558 2 жыл бұрын
@@JonPeppinck Hi Jon, thanks for replying! Yeah, I've watched some of your videos on RxJS, it was good! I used to use Promise when working with asynchronous so that why I suggest you make some on RxJS haha.
@huuquocdattran2877
@huuquocdattran2877 2 жыл бұрын
Hi , I had a BUG : ERROR [ExceptionsHandler] Cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated values. I ca'nt add body :''this is a boydy" and Update body
@shahrilahmedsiddiquee8735
@shahrilahmedsiddiquee8735 2 жыл бұрын
It was very easy to understand 👍 subscribed
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Thanks so much :)
@gabrielteixeira7872
@gabrielteixeira7872 Жыл бұрын
Can you tell me the version of node, nest cli and things that I can make the same as yours? Apparently mine has a lot of recent stuff and every time I have problem with Eslint or something else referring to different versions.
@JonPeppinck
@JonPeppinck Жыл бұрын
Hi Gabriel, the code is on GitHub if you want to clone the repo to ensure everything is the same. Alternatively, you could check out the exact versions in the package.json file, alongside other config files in the root of the folder
@gabrielteixeira7872
@gabrielteixeira7872 Жыл бұрын
@@JonPeppinck I did that, but I was in doubt if you can do something like that without cloning the repository. For example, building the project from scratch with the dependencies on the same versions as the ones in the video, at least close maybe. I use NVM and I installed node 16 and until with this version I didn't have any more errors and I finished the crud class, I'm going to the second class.
@JonPeppinck
@JonPeppinck Жыл бұрын
@@gabrielteixeira7872 Thank you for taking the time to figure out the versioning issue, and share your findings with future viewers that want to code along. It sounds like you are enjoying NestJS so far. Thanks for checking out these videos. Enjoy!
@gabrielteixeira7872
@gabrielteixeira7872 Жыл бұрын
@@JonPeppinck I thank you very much! I'm from Brazil and I'm not very good at English, I've been following the subtitles, sometimes there are some strange things but I'm practicing. In addition to helping me understand development with angular + nest, it has helped me with my listening and practice of English. I am so grateful that you exist and are such a wonderful person.
@JonPeppinck
@JonPeppinck Жыл бұрын
@@gabrielteixeira7872 thanks so much Gabriel. Your written English is great. Keep up the good work :)
@sanjeevacharya2922
@sanjeevacharya2922 2 жыл бұрын
where is videos of authentications in it? I have watched this video
@sanjeevacharya2922
@sanjeevacharya2922 2 жыл бұрын
PLEASE SEND THE LINK
@JonPeppinck
@JonPeppinck 2 жыл бұрын
@@sanjeevacharya2922 Thanks for watching. The playlist is in the description. Authentication is video 8. RBAC is video 9 and 10 for the backend and frontend respectively. Enjoy!
@sanjeevacharya2922
@sanjeevacharya2922 2 жыл бұрын
@@JonPeppinckin your playlist , the authentication are showing at video 9..but you are saying 8
@sanjeevacharya2922
@sanjeevacharya2922 2 жыл бұрын
i am confuzing
@Faaaaaaaaaaaaz
@Faaaaaaaaaaaaz 2 жыл бұрын
Thank you for tutorial. But what was the purpose of rxjs here?
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Mainly to introduce how it works for later videos that benefit from it. Like Angular, NestJS comes bundled with rxjs. You don't have to use it. Async await can be much easier but also less powerful, and the idea was to have a standardized approach using the tools of the framework. FWIW, in retrospect I probably would just mix the two approaches if working on personal projects without strict coding guidelines. RxJS is great if you invest the time in learning it, but had a bit of a learning curve, and can make some things with third party libraries and ORMs harder, and end up converting to and from promises and observables. TLDR do what you feel like.
@Faaaaaaaaaaaaz
@Faaaaaaaaaaaaz 2 жыл бұрын
@@JonPeppinck thank you detailed response. Would be nice to see real life cases where you can utilise rx in nest. I was surprised to see it in backend framework, and curious what was the purpose. Except for angular fan devs mantra about learning curve :) and how great rx is in some theoretical rare edge cases I haven't seen any beneficial practices of using rxjs in real life apps. In all cases I've seen rx used just for handling async operations and filter/map some data, but it can be done the same with just array of promises. Sorry for hollywar, but I'm just curious what I'm missing from rx in nestjs :D
@JonPeppinck
@JonPeppinck 2 жыл бұрын
@@Faaaaaaaaaaaaz No worries. RxJS isn't completely useless. It took me a couple of years to understand - but I learnt it because I got deep into Angular and found it to be quite useful there (i.e. managing state, subjects, third party libraries, HTTP and common libraries, etc). RxJS builds up on promises/async operations, so you could build the functionality yourself if needed. I probably wouldn't be bothered if you use another frontend framework like React though. If you want to get an idea of how I've used RxJS check out the service files in the GH repo. There were a few cases where it came in handy such as joining complex queries, returning new promises, chaining pipeable operators together, i.e. switchMap, and other maps. You could also check out RxJS docs to get an idea. I tend to agree in the sense that it is more useful in Angular, but since NestJS is based off Angular, the feature was preserved. After doing the LinkedIn Clone I realised that async await is just so much easier and would make my life easier by using it, unless I run into a specific use case.
@Faaaaaaaaaaaaz
@Faaaaaaaaaaaaz 2 жыл бұрын
@@JonPeppinck thank you! I would definitely have a look 👀 into repo
@ZANYSTREAMS
@ZANYSTREAMS 2 жыл бұрын
im getting type orm not exported error i dont know why
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Try importing it in the parent module, under all your other imports. It could be possible that the order matters here - check the GitHub repo in the description. If not, it is probably either not installed correctly, setup correctly, or an environment issue.
@ZANYSTREAMS
@ZANYSTREAMS 2 жыл бұрын
@@JonPeppinck thanks for your reply ❣️
@mahendranb6937
@mahendranb6937 2 жыл бұрын
No repository for "FeedPostEntity" was found. Looks like this entity is not registered in current "default" connection? How to resolve it ???
@aldowisnu7546
@aldowisnu7546 2 жыл бұрын
please save it first
@estebanrojas1873
@estebanrojas1873 Жыл бұрын
I have a problem using a postgres database, the database is created with a "public" schema that doesn't allow me to use typeorm, how can I add that schema in general?
@JonPeppinck
@JonPeppinck Жыл бұрын
I believe all postgres databases have a public schema for general purpose things which is independent of the tables that we create that get mapped to entities.
@SuperCodepk
@SuperCodepk 2 жыл бұрын
Great!
@JonPeppinck
@JonPeppinck 2 жыл бұрын
Thanks Yasir!
@Zerowolrd
@Zerowolrd 3 жыл бұрын
Hello jon, I'm so Thank you !!! I'm subscribed but I don't know channel to support you. if you have course on udemy or something please let me know. Thank you :)
@JonPeppinck
@JonPeppinck 3 жыл бұрын
Thanks so much! Really appreciate the subscription and support. I have thought about making a Udemy course - Perhaps next year - I would want it to be super high quality - Probably relating to Angular and/or NestJS. Right now I'm just trying to grow my channel from 1 to 5k subs - so I have a larger audience. Really liking NestJS and plan on diving much deeper into the framework. Thanks again, enjoy!
@barakadewise7200
@barakadewise7200 Жыл бұрын
Thanks for this tutorial it has brought me from zero to somewhere else ..hope to get more videos in future
@JonPeppinck
@JonPeppinck Жыл бұрын
Thanks so much! Will be making some more NestJS content for sure.
@balvindersingh4307
@balvindersingh4307 3 жыл бұрын
@Jon Peppinck. I am facing problem in body. Everytime is showing empty body. Could you please help in it ??
@riteshpatil1248
@riteshpatil1248 3 жыл бұрын
in Postman ? choose JSON in postman in upeer nav menu where raw is present right now might be text is written there
@zach990il4
@zach990il4 2 жыл бұрын
why didn't you explain how to set the server in pgAdmin ?
@JonPeppinck
@JonPeppinck Жыл бұрын
I have done this in another video on the channel
@sucessoemtudo1007
@sucessoemtudo1007 Жыл бұрын
Very good
@JonPeppinck
@JonPeppinck Жыл бұрын
Thanks so much!
@AliAliOxenFree
@AliAliOxenFree Жыл бұрын
quality video. key points explained clearly. you earned a new sub!
@JonPeppinck
@JonPeppinck Жыл бұрын
Thanks so much! You subscribed at a great time. Will have a new video out soon!
@ukaszsliwa7999
@ukaszsliwa7999 Жыл бұрын
Subscribed, thank you for the video. You have no idea how easy it was to follow, exactly what I had needed.
@JonPeppinck
@JonPeppinck Жыл бұрын
Thanks so much for subscribing! Really glad you liked this video. I have lots of videos on NestJS on this channel!
@k2nnethtan949
@k2nnethtan949 2 жыл бұрын
Any way to list down all columns be used without declaring individual? Example to use existing database schema, and load all the columns?
@JonPeppinck
@JonPeppinck 2 жыл бұрын
You don't have to create the class/interface/DTO that represents your database schema if you don't want to - although it is good practice. In addition to the query builder, TypeORM has a entity manager class - which has a query method - which allows you to write custom SQL queries. I would avoid doing so though unless you have a special reason or a complex query that you can't easily make using TypeORM. We do cover more complex queries later on in the course. Good luck!
@k2nnethtan949
@k2nnethtan949 2 жыл бұрын
@@JonPeppinck With current method, it will loaded entire row or data, it may crash once the data is huge or network is slow. Do you have any sample can guide?
@alahirajeffrey
@alahirajeffrey 2 жыл бұрын
I recently got an internship with a company that uses nestjs. At first it looked so abstract to me but your tutorials are helping me understand it better. Thanks. God bless
@JonPeppinck
@JonPeppinck 2 жыл бұрын
That is awesome! Happy you got an internship and you get to use NestJS for it! Good luck!
@ringgo6521
@ringgo6521 Жыл бұрын
this is awesome!, thanks dude
@JonPeppinck
@JonPeppinck Жыл бұрын
Really glad you are liking NestJS. Thanks for watching!
Nestjs PostgreSQL CRUD REST API Example with Typeorm
25:56
ZestMade
Рет қаралды 11 М.
NestJs | Tamil | NestJs Api | Crud | Cheetah Media
1:03:26
Cheetah Media
Рет қаралды 12 М.
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 53 МЛН
Do you choose Inside Out 2 or The Amazing World of Gumball? 🤔
00:19
Nest.js Crash Course : A Comprehensive Step-by-Step Tutorial
1:10:43
Postgres just got even faster
26:42
Hussein Nasser
Рет қаралды 32 М.
TypeORM Tutorial: Migrations, queries, and more! | NestJS
45:38
Marius Espejo
Рет қаралды 106 М.
NestJS, MySQL, TypeORM Crash Course
1:17:38
Anson the Developer
Рет қаралды 98 М.
Build your first REST API with Flask and PostgreSQL
27:42
teclado
Рет қаралды 68 М.
Ionic Angular Theme and Popover
1:11:08
Jon Peppinck
Рет қаралды 5 М.
No-Nonsense Backend Engineering Roadmap
10:16
Codebagel
Рет қаралды 205 М.
Nestjs CRUD example with MySQL & TypeORM
42:09
ZestMade
Рет қаралды 23 М.
Why So Many Developers Choose NestJS?
7:35
Tech Vision
Рет қаралды 7 М.
Build Complete REST API in NestJs #1 - with TypeScript & MongoDB
31:05
Coding With Abbas
Рет қаралды 64 М.