TypeORM Crash Course - TypeScript & Node ORM

Поділитися
Вставка
  • Опубліковано 5 сер 2024
  • TypeORM is a great node ORM that allows you to create tables and perform CRUD operations with TypeScript & JavaScript. You can use it with multiple databases like MySQL, Postgres or MongoDB.
    Postgres install:
    www.postgresql.org/download/
    Postico install:
    eggerapps.at/postico/
    GitHub Repo:
    github.com/harblaith7/typeorm...
    Timeline:
    0:00 - Intro
    5:35 - Setup
    8:30 - Connecting to the DB
    22:06 - Entities
    43:45 - Relationships
    1:01:30 - Inserting Data
    1:15:15 - Forming Relationships
    1:34:49 - Deleting Data
    1:43:10 - Fetching Data

КОМЕНТАРІ • 107

  • @skverskk
    @skverskk 3 роки тому +4

    Awesome. I like the way you take your time to slowly explain everything in easy-to-understand detail.

  • @barisballi70
    @barisballi70 2 роки тому +19

    Amazing tutorial, I was planning to dive into the documentation but this tutorial make my learning journey much much smoother, now I have the basics and I can check the docs to learn more

  • @stanleychukwu7424
    @stanleychukwu7424 2 роки тому +5

    the way you explain any subject/topic/framework/language is exceptional, keep the good work up mate! wishing you all the best.. you're a top level teacher.. and then again, your consistency is excellent!

  • @user-wz6gj1bb7f
    @user-wz6gj1bb7f 3 роки тому +17

    Very much appreciated lecture!! i didn't have a lot of information on TypeORM, so this was very enlightening!!

  • @jasmyneokudo
    @jasmyneokudo 2 роки тому +1

    Halfway through, just said to to say thank you for putting this up and yes, even if we can't see it, we will take your word for it

  • @cgarafulic
    @cgarafulic 3 роки тому +1

    Excellent explanation about TypeORM. What a powerful tool to model and make transactions in any type of database. Thank you for creating such amazing video.

  • @wahebbenzaid2591
    @wahebbenzaid2591 3 роки тому

    just Great, I discovered this channel since a week ago, I think it's a geat channel, I learned NestJS from scratch with you Laith. I'm waiting for a project that combines nestJs and typeORM, thank you a lot :)

  • @Shakeel714
    @Shakeel714 3 роки тому +1

    Wonderful crash course!!! Thanks so much Laith Harb.

  • @robdev89
    @robdev89 2 роки тому +1

    Thanks so much! Really an Excellent tutorial, ;-) I didn't know much about decorators, so TypeORM all seemed kind of magical coming from Sequelize. But this really does seem a lot more simple in the long run. Cheers to you!

  • @andrenk
    @andrenk 2 роки тому +2

    Exceptional tutorial! I've just started to learn PERN Stack project and currently adopting your tutorial into my own project. Despite some of the syntaxes are already deprecated, I can still managed to complete the project! Thanks

    • @ijustdey
      @ijustdey Рік тому

      Which of the syntaxes are deprecated?

  • @joshuasabac2389
    @joshuasabac2389 3 роки тому +1

    One of the best yt channel for developers . Thank you :)

  • @ginn1349
    @ginn1349 3 роки тому

    Thanks, Laith. I'm really like your way to explain everything. Awesome!!.

  • @rehansattar8990
    @rehansattar8990 2 роки тому +1

    Thank you so much for this amazing tutorial! Highly appreciated.

  • @parsahosseini4241
    @parsahosseini4241 Рік тому

    Just found a gem on the UA-cam, right on man, great course❤

  • @thimothelamoureux5718
    @thimothelamoureux5718 Рік тому

    Fantastic, thanks for making this tutorial which brought me many insights on relationships

  • @gthaka
    @gthaka 2 роки тому

    Thanks for a simple and straight forward tutoral 😎💯👌🏾

  • @richardurena5867
    @richardurena5867 2 роки тому

    that is one hell of a crash course! thanks

  • @CoderNadir
    @CoderNadir Рік тому +1

    that was really enjoyable, I've learnt a lot from you thanks, I'm coming from a mongoose background and it is kinda the same at some points, again thanks a million Laith 💚💚

  • @First_Code
    @First_Code Рік тому

    amazing hope all tutorials on youtube just like your tutorial

  • @nelsonjo14
    @nelsonjo14 Рік тому

    Excellent tutorial, thank you very much for sharing it!!!

  • @randfamous
    @randfamous Рік тому

    mastered type orm with this single video thanks bro ....

  • @johnmilimetron7115
    @johnmilimetron7115 Рік тому

    This chan is just a fckn treasure!!! Thank man.

  • @12312312423
    @12312312423 Рік тому

    Thanks for timestamps!

  • @eminberkay
    @eminberkay 8 місяців тому

    Great lecture, thanks mate!

  • @haiderjaafer8164
    @haiderjaafer8164 3 роки тому

    Great work keep going forward… hope next course is restful api using nodejs

  • @stathisioan7799
    @stathisioan7799 2 роки тому +5

    Would really be interesting like 10-15min video , showing the right way to use the environment variables, and maybe a .env.example file or sth!!
    Thanks in advance!

  • @mehtabahmed6092
    @mehtabahmed6092 2 роки тому

    Always love you!!!!
    Thank you!

  • @adilsyed8369
    @adilsyed8369 2 роки тому

    thank you so much for this amazing tutorial.

  • @juststudying1019
    @juststudying1019 Рік тому

    Thanks, your explanation is very good.

  • @esmelindagarcialorenzo3347
    @esmelindagarcialorenzo3347 2 роки тому

    Excelente tutorial, gracias por compartir!

  • @nateechaichana1717
    @nateechaichana1717 Рік тому

    thank you from Thailand 🙏🙏🙏

  • @vivuuc4209
    @vivuuc4209 Рік тому

    Quite great and simplified

  • @cliffordowusuamponsah9532
    @cliffordowusuamponsah9532 2 роки тому +1

    @Laith Harb. I see you get some suggestion from vscode when trying to specify a type in the column decorator. Please is it an extension?? If not, how do I get the same functionality in my vscode editor?

  • @andifaizal6848
    @andifaizal6848 2 роки тому

    You are amazing , explain very detail.

  • @exoneuromancer1672
    @exoneuromancer1672 Рік тому

    Very good stuff thank you for teaching us

  • @aliiiimansour
    @aliiiimansour 2 роки тому +1

    Hi Laith, thanks for your astonishing video, if possible, please make a video for mongodb using mongoose in a practical app same as you did in this video for typeorm .

  • @adithyapaib
    @adithyapaib 3 роки тому +2

    Really love this channel can u do a crash course on reactJS and ExpressJS

  • @muhammadhamzah3230
    @muhammadhamzah3230 Рік тому

    GreafFull tutorial, thanks

  • @braker37
    @braker37 10 місяців тому

    Amazing tutorial! Off to learning SQL now. A bit backwards, I know.

  • @debarghyachakraborty
    @debarghyachakraborty 2 роки тому +5

    To solve the error of _'ts-node' is not recognized as an internal or external command, operable program or batch file_ use this in package.json file:
    _"dev": "nodemon --watch \"./**/*.ts\" -e ts --exec \"npx ts-node src/index.ts\""_

  • @badr4u73
    @badr4u73 3 роки тому +3

    Great video , but i have some remarks:
    why you didn't use typeorm cli which help bootstrap the app and help generate entity / migration ... ,
    and you didn't add the reflect-metada which is required by typeorm at least in the docs

  • @namesare4fools
    @namesare4fools 3 роки тому

    Hi Laith Harb, how would you compare TypeORM with Prism ?

  • @vishnyo
    @vishnyo 2 роки тому

    like definitely. Thank you

  • @geekySRM
    @geekySRM Рік тому

    Amazing!

  • @rakeshkrishnan8510
    @rakeshkrishnan8510 2 роки тому

    Thanks a lot my brother

  • @lghiggino
    @lghiggino 2 роки тому +5

    Hey Laith, how are you doing? I appreciate the content. Its been very helpful. One question though: at 1:32:06 you try to save the [ ...banker.clients, client ], and get an non-iterable error. I got that, and understood what you did to fix, BUT, if I try to create a new many to many relation it only overwrites whatever is in the JoinTable, and does not create a new relation. I was wondering how could I fix that? I tried to POST instead of PUT, I tried to concat but its not working.

    • @therealhramov
      @therealhramov 2 роки тому +1

      Hey! It's because in this case you write every time not append. Try banker.clients.push(client)

    • @markod3957
      @markod3957 Рік тому +2

      @@therealhramov This is incorrect, the push and the spread achieve the same things, the problem is that the clients array is currently not accessible from the banker object you have fetched., hence banker.clients is null here.
      You have to add the 2nd argument in the form of any object to your @ManyToMany decorator in your Banker entity file -> the object being {cascade: true, eager: true}

  • @ahmedmarwan2308
    @ahmedmarwan2308 2 роки тому

    thanks a lot brother

  • @debarghyachakraborty
    @debarghyachakraborty 2 роки тому +2

    If transaction amount concatenates with client balance as string and not adds as number, do this:
    _const numberAmount = Number(amount)_ and _Number(client.balance.toString())_

  • @ramiworkstation
    @ramiworkstation Місяць тому

    Thank you

  • @samrat131
    @samrat131 Рік тому

    hi, can we achieve one-to-many/many-to-one relation using TypeORM: select table1.*, table2.*
    from table1 left join table2 on table1.pk_id=table2.fk_id and table1.status=1 , here main concern is to join table with multiple condition , thanks

  • @vuongqtvn
    @vuongqtvn 2 роки тому

    nice tutorial

  • @willcalltickets
    @willcalltickets 3 роки тому +1

    Thanks Laith - great video. Can you explain why despite defining the balance column type as 'numeric' and the field as a 'number' it is ultimately being treated as a string?

    • @colossus95
      @colossus95 Рік тому

      yeah it behaves weird. But just keep initial value to 0. Then deposit/withdraw will work fine.

  • @user-ze6ip7vt8y
    @user-ze6ip7vt8y 9 місяців тому

    1:34
    The way you did it, it will always update the table and only add the banker and client relation passed at that time and will remove the older one, although it should keep all the record.

  • @worldwide6626
    @worldwide6626 7 місяців тому

    That example in 59:15 was confusing. Could you please clarify the @joinColumn command?

  • @Tarukami
    @Tarukami 3 роки тому

    Man, thats a great tutorial! Touching a lot of aspects, very informative, nicely explained. Even such a stupid asshole as me got all the things clear.

  • @ekkirizkiramadhan3553
    @ekkirizkiramadhan3553 2 роки тому

    thanks, this great, this is helpfull

  • @bulentgercek
    @bulentgercek Рік тому

    Thanks

  • @AnkitTannaVlogs
    @AnkitTannaVlogs 5 місяців тому

    Amazing tutorial. Some sections need an update of some deprecated functions...

  • @sureshkumarkv139
    @sureshkumarkv139 2 роки тому +1

    Great video. Thank you for this. A humble request though. At 01:24, There are 2 save actions. First for the transactions object and then for the client object. I know this is better done with a DB transaction. Can you add a chapter for DB atomic transactions using TypeORM into this course please?

  • @thecurious926
    @thecurious926 Рік тому

    why did you do banker.client = client? what if there is a new client for the same banker?

  • @ramiworkstation
    @ramiworkstation Місяць тому +1

    [npx tsc --init] to auto-generate tsconfig.json file. thank you for sharing the lesson.

  • @APerson-d5s
    @APerson-d5s 3 роки тому +1

    Hello, I am running into the following right at the start "''ts-node'' is not recognized as an internal or external command,
    operable program or batch file." any help would be great!

    • @laithacademy
      @laithacademy  3 роки тому

      Try installing ts-node globally with:
      npm install -g ts-node

    • @APerson-d5s
      @APerson-d5s 3 роки тому +7

      FIXED: If you are using Windows at @13:03 instead of using single quotes within the dev you have to use (\"), thus looking like this "nodemon --watch \"./**/*.ts\" --exec \"ts-node\" src/index.ts"

    • @tarunpatel1457
      @tarunpatel1457 2 роки тому

      @@APerson-d5s thanks man

  • @riyachapatwala8035
    @riyachapatwala8035 2 роки тому

    Does this code include whole backend?

  • @paweld.9542
    @paweld.9542 2 роки тому

    I don't understand why you define JoinTable in Banker entity and not in Client entity ? What is rule for that ?

  • @McElitsome
    @McElitsome Рік тому

    This was so tough. The createConnection() function is outdated, I can't even connect to my database and there's no error that is caught when trying to do so. Even 'node --watch' doesn't work when tryong to connect to the database. There's no explanation on how to set up the database using the simple pgAdmin app. Everything from the beginning was just a mess. Correct me if I'm wrong. I'm open to anything that will make my connection work for me to learn typeORM. Other than that, here's where I give up with trying to use SQL in NodeJS

  • @namduongdangchat198
    @namduongdangchat198 2 роки тому

    how make a controller there are 4 method: getAll , create , update , delete from repository ?

  • @jamalwebdevelopment4841
    @jamalwebdevelopment4841 2 роки тому

    is there anybody who knows how to get ( find out ) username in postgreSQL if you are using windows ?

  • @DeepakKumar-ss2ql
    @DeepakKumar-ss2ql Рік тому

    you did a perfect job sir...but the caption in your video reads typeORM=typeworm

  • @lifeisbeautifu1
    @lifeisbeautifu1 2 роки тому

    🔥🔥🔥

  • @simonx3088
    @simonx3088 2 роки тому

    it do not support dgraph database connection , hope they can solve it quickly

  • @MehediBijoy
    @MehediBijoy Рік тому

    what is your database client name ?

  • @user-vm8yn4hb4w
    @user-vm8yn4hb4w 3 роки тому

    Good

  • @SotovisionHD
    @SotovisionHD Рік тому +2

    If you are watching this, after this comment was posted, createConnection is deprecated, now you need you use new DataSource

  • @riyachapatwala8035
    @riyachapatwala8035 2 роки тому +1

    first install all the dependencies and then in your cmd,
    write typeorm init --name project_name
    where project_name is the name of ur choice,
    if doesnt work then use this same command with npm
    this will give you the whole template

  • @by_sKeep
    @by_sKeep 2 роки тому +1

    Why this is free...?
    Thank you very much!

  • @erickgeneric
    @erickgeneric Рік тому

    and I thought we were about to get sentimental @ 43:45

  • @hemanthatkuri8940
    @hemanthatkuri8940 Рік тому

    createconncection is not working

  • @brancode404
    @brancode404 3 роки тому

    Please do Vue3 crash course and how to deploy it

  • @designcoded7585
    @designcoded7585 2 роки тому

    hi sir alternatives for windows postgres server

  • @tripleworldpain
    @tripleworldpain Рік тому

    "Whoat eees an uoooramm?"

  • @zlatkoiliev8927
    @zlatkoiliev8927 Рік тому

    Very good tutorial, but a little out dated. Are you planning on updating this one?

  • @dinonjim
    @dinonjim 3 роки тому +1

    you not perform any query to manytomany relation.

    • @milanm2605
      @milanm2605 3 роки тому

      I was thinking of the same thing, why would someone skip that part when it's such a common usecase?
      Anyways, good tutorial overall, thanks Laith.

  • @mostaphaamghare313
    @mostaphaamghare313 2 роки тому

    ho about polymorphic relationship

  • @waelgh4307
    @waelgh4307 8 місяців тому

    Be careful with synchronize option and don't use this in production - otherwise you can lose production data

  • @ananasior
    @ananasior Рік тому

    1:34:45

  • @k.ashutoshbaitharu3964
    @k.ashutoshbaitharu3964 10 місяців тому

    I think the many-to-many relationship is taught incorrectly here. Not getting the expected output also the logic doesn't make sense.

  • @zlatkoiliev8927
    @zlatkoiliev8927 Рік тому

    This typeorm is forcing really bad practice. Inherit classes on 2 levels. This is not ok.

  • @jackfrost8969
    @jackfrost8969 9 місяців тому

    15 min in the video and already encountered the issue in dev script and looking at the comments, it doesn't look like it will go well. I will try to install the exact packages version and see if I can make it work.
    Anyway, to solve the error of 'ts-node' is not recognized as an internal or external command, operable program or batch file, use this in package.json file:
    "dev": "nodemon --watch \"./**/*.ts\" -e ts --exec \"npx ts-node src/index.ts\""
    The deault username for postgres in windows is "postgres"

  • @ahmedmarwan2308
    @ahmedmarwan2308 2 роки тому

    thanks a lot brother

  • @ballonura
    @ballonura 3 роки тому

    Thanks