Mastering Sequelize Typescript in Node.js

Поделиться
HTML-код
  • Опубликовано: 9 окт 2024

Комментарии • 19

  • @chukwumaohuabunwa
    @chukwumaohuabunwa 6 месяцев назад +1

    The use of these decorators will most likely make guys from Java (like myself) smile. Thanks for the update.

    • @alexrusin
      @alexrusin  5 месяцев назад

      It makes the guys from JavaScript who know Java smile as well. I think those decorators are a bit too much. Newer ORMs like Prisma use a more elegant approach.

  • @SonuKumarTech
    @SonuKumarTech Год назад +2

    straightforward and to the point. Loving this Sequelize tutorial

  • @watchparty1
    @watchparty1 Год назад +1

    Another solid tutorial. I'm definitely subscribing. Please keep 'em up!

  • @juniorluis890
    @juniorluis890 Год назад +2

    where can i get the project repository?

    • @alexrusin
      @alexrusin  Год назад

      You can find it right here: github.com/alexrusin/travel-api-travels-service

  • @rodrigosilva1302
    @rodrigosilva1302 Год назад

    When I try to add @Column decorator to a "declare" I receive an error "Decorators are not valid here". If I change the property to "public name!: string" it works. But this way I cannot override Model properties such as id, createdAt and updatedAt.
    I'm not using the example repository. Was trying to add sequelize to an existing typescript project

    • @alexrusin
      @alexrusin  Год назад

      Did you use sequelize-typescript package? Also, did you set "experimentalDecorators": true, "emitDecoratorMetadata": true in "compilerOptions" in tsconfig.json?

    • @rodrigosilva1302
      @rodrigosilva1302 Год назад

      @@alexrusin I did both of them. It seems like a project specific configuration that I did not know about. When I tried the tutorial steps on a new project it worked like a charm.
      But on this specific project it shows me this error when I try to use declare with the decorator.

    • @Axelazo
      @Axelazo 8 месяцев назад

      @@rodrigosilva1302 were you able to pinpoint the exact reason?

  • @VaIrMp
    @VaIrMp Год назад +1

    when i try to connect two tables with HasMany and ForeignKey, I get errors like "No overload matches this call" and "Types of construct signatures are incompatible." The code is the same.
    Edit: fix in the comments

    • @VaIrMp
      @VaIrMp Год назад +1

      The issue was that "Model" was being imported from "sequelize" and not "sequelize-typescript". Anyway, thanks for the tutorial, keep it up!

  • @GabrielAdekeye
    @GabrielAdekeye 8 месяцев назад +1

    How did you run migration?

    • @alexrusin
      @alexrusin  8 месяцев назад

      Migrations are actually in a different project github.com/alexrusin/travel-api-db-migration-service
      Sometimes it makes sense to create a separate service for migrations so you don't run migrations every time you deploy your project, especially when you are working with microservices.

  • @Bomb_and_Kou
    @Bomb_and_Kou 8 месяцев назад +1

    Seems like this is not yet supported on current LTS. ESBuild throws a bunch of errors about lacking decorator support for node 20

    • @alexrusin
      @alexrusin  8 месяцев назад

      Interesting. I'm going to test it on node 20 when I get a chance. You did put "experimentalDecorators": true,
      "emitDecoratorMetadata": true in your tsconfig.json, right?

    • @Bomb_and_Kou
      @Bomb_and_Kou 8 месяцев назад

      @@alexrusin That is what esbuild was throwing on. I got around it by using swc instead of esbuild. Issue is not with the core tutorial itself, but some of the technologies.