Build a CRUD API with TypeScript, Express, MongoDB, Zod and Jest

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

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

  • @prerakhere
    @prerakhere Месяц назад +1

    I learn so much extra stuff everytime i see your livestream. Thanks.

  • @AngelHdzMultimedia
    @AngelHdzMultimedia 2 года назад +17

    My mind is blown. So much useful material discussed in this video. A topic that at first sight looks complicated but you made it look as a piece of cake. I was needing this because i have been recording vids about Vue, Nest, Nuxt, TypeScript, but been avoiding the e2e and unit tests topics. Now i feel confident to start adding them to my projects. Appreciate a lot your charisma and patience. Wishing you health and success.

  • @wintoniw703
    @wintoniw703 2 года назад +1

    You're so advanced, CJ! Also, your effort in sharing in-demand knowledge is immense! Bless your heart!

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

    I looked for an express tutorial with the MongoDB driver but not found any proper tutorial (mostly found with mongoose library). This one is awesome as it not only shows the proper usage of MongoDB driver with zod and typescript. Great video🙏

  • @MistaT44
    @MistaT44 2 года назад +3

    Great stuff as always, thanks CJ!

  • @atraps7882
    @atraps7882 2 года назад +1

    Ive written several backend APIs with express and plain JS but im looking more into TS nowadays for reasons like clean-er architecture and improving code quality by having a more structured and predictable behavior using types. This tutorial allowed me to bridge my existing knowledge of building RESTful APIs in node+express with TypeScript magic. Thank you Mr. CJ

  • @_rushikesh_ganesh
    @_rushikesh_ganesh 2 года назад

    Your lifesaver!! Recently I was working on an express + typescript project I didn't find that much content for it 🙏

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

    Keep up the great work! I used to be active in your Discord. I love how respectful you are! Awesome work, Cody!!

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

    Great bloke, great video, great all round! Thanks CJ, helped me a lot.

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

    I saw you on twitch a long time ago, but I didn't remember your name.
    So glad I found you again, exactly at the right time :)
    Keep up the work you do, I really appreaciate it!

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

    Amazing tutorial! thank you very much. I love your chilled style of coding. Hello to Colorado!

  • @zlatkoiliev8927
    @zlatkoiliev8927 2 года назад +1

    So so happy I have subscribed to your channel!!! I have learned really a TON thanks to your vids!

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

    your video so relaxing and soothing for an educational tutorial video, man!
    I love it so much!
    Keep it up, okay? i know viewer may have high hope for you, but don't let it burden you, just keep it up!

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

    So glad I ran into this video! Wanting to move towards using typescript and this and your intro video are toooo good. Thank you so much for the effort! Not sure if you plan on doing more content about testing and/or jest, but I would really enjoying learning more about it from you

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

    this is what i am searching. Thanks for sharing

  • @mahmoudalaskalany
    @mahmoudalaskalany 2 года назад

    His explanation is awesome ✨

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

    This is outstanding! 🌠🌠🌠🌠🌠 You're such a GREAT instructor, I think I've discovered you late! This is the second video I'm seeing from your channel and this is all amazing!
    Please also do the follow-up video 😭😭😭😭😭
    One small recommendation: In a follow-up video "before adding a client", do a refactoring video on all this code once again so that it's as close as possible to a production-ready API and deploy it! Also there are parts in this video that you've said "let's not do that for now", those are good topics as well to talk about and add improvements!
    Thank you CJ! 💖💚💛

  • @saminyasar004
    @saminyasar004 2 года назад

    Great video. Thank you very much, CJ. Take love💚

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

    Hey CJ I just want to tell you that you're great. I love your videos and you're really an inspiring person. Love the way you explain things and help people to understand better. I wish you always the best, and that you can continue in this way
    P.S
    I didn't see on your Twitch channel the live about nuxt 3, regarding the new framework you will use for the next Friday project. Will you upload it here on RUclips? Thanks so much

  • @AJax2012
    @AJax2012 2 года назад +5

    Great video! Question though - you said in your video that you would create a link to a config loader video, but I don't see one? Maybe I'm missing something, but you mention it at around 00:27:00 I'm interested in seeing how you would create one - the only place I have ever actually seen one in JS/TS is Nest.js, I think. It definitely sounds like it would be more convenient than depending on process.env every time I need to get a configuration variable, haha. Only thing that really comes to mind though is some sort of a static variables file...

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

    Great video. I already have an MVC app with objects and it doesn't use ZOD. I am curious how easily ZOD can be applied to existing objects without redefining everything.

  • @instinct_gallant8694
    @instinct_gallant8694 2 года назад

    up to now. Your soft is great too!

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

    Thank you so much man

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

    awesome content, thanks

  • @1nf0rmm3pls9
    @1nf0rmm3pls9 Год назад

    I learned a fucking lot. Respect for that awesome lesson!

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

    learned content. Thnx

  • @Luke-Barrett
    @Luke-Barrett Месяц назад

    With the latest version of nodemon you don't need to install ts-node separately.

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

    Shall we not mock the DB instead of making actual calls to DB while writing test cases? WE may lose actual data if the db.drop( ) runs also DB calls will have a cost and impact the overall costing whenever the tests are run.

  • @LawZist
    @LawZist 2 года назад

    event driven project with pubsub and message broker would be awesome!

  • @xtraszone
    @xtraszone 10 месяцев назад

    Instead of zod, you should use super-easy-validator

  • @abw21701
    @abw21701 2 года назад

    Quick question: I've seen advice about getting into coding. One thing I found is that is suggested that I just get a job in coding - basically get paid to learn - Does that make sense to you? Is that how you got started?

  • @ozgenduru9165
    @ozgenduru9165 2 года назад

    tNice tutorials actually was, and I'm just starting myself, I have no idea what I'm doing but I have a ton of ideas in my head. Ti to figure tNice tutorials out

  • @walkingin6375
    @walkingin6375 10 месяцев назад

    Why is it such a headache and takes so much work to just make a rest api in TS?
    Go + Gin is so much cleaner, and easier to write it out. :/

  • @bruhgoaway4876
    @bruhgoaway4876 2 года назад +1

    Hi, could anyone provide me some clarity on an issue I'm facing? I'm performing the POST req test which is supposed to expect a 422 error (~57:00). However, my request doesn't yield this 422 error, and instead creates the post. After playing around with the Todo schema, I noticed that no matter what I set the content as, the Todo still get validated and pushed to Mongo. I can even add an integer or null into the content field, and the data still gets pushed to Mongo. The only place the "content" prop appears is in test files and the todos.model.ts file. Could anyone give me some insight as to what's going on here?
    P.S. Great video Coding Garden! Regardless of this error, I still learned a lot, and you provide a lot of useful resources and gave insight that helped clarify many other questions I had throughout the video.
    UPDATE: I solved the issue minutes after posting this. I was checking out the Github repo for a solution, and had removed this line from the createOne() function: const validateResult = await Todo.parseAsync(req.body);
    I was wondering why this line wasn't in the final version of the code, but then also realized it was refactored into the validateRequest middleware.

    • @CodingGarden
      @CodingGarden  2 года назад +1

      Glad you figured it out! The indirection to the middleware can definitely be a bit confusing if you're looking at the handlers file only.

    • @bruhgoaway4876
      @bruhgoaway4876 2 года назад

      @@CodingGarden I appreciate it. Also, just a possible future video suggestion, but I really liked how you displayed the process of writing tests and resolving failures. The way you utilized the result of a POST request to test retrieving a single ID was really smart, yet not a tactic I've seen in other Jest videos. Additionally, you seem to understand Jest configurations really well, which is something that's hard to grasp/find better explanations of when using just the docs and info from blogs.
      Regardless though, you did a really good job at covering all the tools you put in the title 👍

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

    Hi CJ, your content is really helpful. I really learnt a lot.
    I have a small question to ask How can I handle the "Promise returned in function argument where a void return was expected."? When you send the findAll as async function in typescript it gives a warning because of promise void.
    Because in router .get it won't accept promise void functions. One solution I came across is to use async function in side find all method.
    But in this case we have to use in every function in the handler. Is there a better approach ?
    Thank you

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

      Have you found any better solution?

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

    what is name of theme extension you use?

  • @The-Average-Gamer
    @The-Average-Gamer 2 года назад

    Hey where is the config loader vid?

  • @ryan_roga
    @ryan_roga 2 года назад

    26:59 is still missing a link. How do I do this config loader? I think that would make a really good short. I couldn't find a video by you using those search terms. Would love to know how, though!

    • @CodingGarden
      @CodingGarden  2 года назад +1

      I think I worked on this during a fresh spots stream, so it would be on the archive channel. You can see the example here: github.com/CodingGarden/fresh-spots/blob/main/app/utils/config.ts
      Remind me next time I'm streaming and I will try to make a video on it.
      There is also this library I've used before: www.npmjs.com/package/config

    • @ryan_roga
      @ryan_roga 2 года назад

      @@CodingGarden Thanks, CJ. I'll have a look for that video.

  • @cinegolpo-movieexplainedin8192

    my vs code ts server is very slow. when i am working, any idea how to improve the performance.
    my PC has 32 gb ram

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

    Does somebody knows where's the next part of this video?

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

      I never created an edited version of these, but you can find the live streams on the archive channel.
      React Client First Try - ruclips.net/video/blqEd9WIcYI/видео.html
      React Client Re-Do - ruclips.net/video/M7K0be9gBeY/видео.html
      Vue Client Part 1 - ruclips.net/video/JwS9nxwC1Vw/видео.html
      Vue Client Part 2 - ruclips.net/video/JOoWbxvcSAg/видео.html

  • @TheArmenianSolider65
    @TheArmenianSolider65 2 года назад +2

    How does Zod compare to Mongoose?

    • @CodingGarden
      @CodingGarden  2 года назад +9

      zod is just a schema validation and type inference library. mongoose is a wrapper on top of the mongodb library that adds ORM like features. This app was simple enough that we didn't need the extra features mongoose provides.

  • @lakessbm
    @lakessbm 2 года назад

    nice video...wish you didnt skip over the mongodb setup though

    • @CodingGarden
      @CodingGarden  2 года назад

      You can read how to install mongodb here: www.mongodb.com/docs/manual/administration/install-community/

    • @lakessbm
      @lakessbm 2 года назад

      i ran the brew commands and have mongod process running on my comp but i never setup any connect uri on mongodb side, so how is the express side going to connect to it? im about 30 mins trhough the tutorial and when i run test after the db.ts setup, i get "MongoNotConnectedError: Client must be connected before running operations". appreciate any help

    • @lakessbm
      @lakessbm 2 года назад

      i see, i think my mongodb is not setup properly, having issues with creating /data/db. will get back to you

    • @lakessbm
      @lakessbm 2 года назад

      this step doesnt seem to be covered in mongodb documentation.

    • @gabrielfarias6273
      @gabrielfarias6273 2 года назад +1

      use MongoDB Atlas

  • @philthy-phil
    @philthy-phil Год назад +1

  • @tcgvsocg1458
    @tcgvsocg1458 2 года назад

    do i hit the like bouton on this video? not yet ok done

  • @saminyasar004
    @saminyasar004 2 года назад

    I think it would be better to use a little background music. Personal preference 🥰

  • @sourav_-_7038
    @sourav_-_7038 2 года назад

    bro, do some distributed nodejs application, like distributed chat app and other things.

  • @barcalover016
    @barcalover016 10 месяцев назад

    god dmnit why you all programmers love to name evrything "todo"

    • @prerakhere
      @prerakhere Месяц назад

      they do so because they want you to define your todos in that todo

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

    `npx create-express-api --typescript --directory` no longer works.
    "error: unknown option `typescript'
    usage: git clone [] [--] []
    -v, --verbose be more verbose
    -q, --quiet be more quiet
    --progress force progress reporting
    -n, --no-checkout don't create a checkout
    --bare create a bare repository
    --mirror create a mirror repository (implies bare)
    -l, --local to clone from a local repository
    --no-hardlinks don't use local hardlinks, always copy
    -s, --shared setup as shared repository
    --recurse-submodules[=]
    initialize submodules in the clone
    --recursive[=]
    alias of --recurse-submodules
    -j, --jobs number of submodules cloned in parallel
    --template
    directory from which templates will be used
    --reference reference repository
    --reference-if-able
    reference repository
    --dissociate use --reference only while cloning
    -o, --origin use instead of 'origin' to track upstream
    -b, --branch
    checkout instead of the remote's HEAD
    -u, --upload-pack
    path to git-upload-pack on the remote
    --depth create a shallow clone of that depth
    --shallow-since
    create a shallow clone since a specific time
    --shallow-exclude
    deepen history of shallow clone, excluding rev
    --single-branch clone only one branch, HEAD or --branch
    --no-tags don't clone any tags, and make later fetches not to follow them
    --shallow-submodules any cloned submodules will be shallow
    --separate-git-dir
    separate git dir from working tree
    -c, --config
    set config inside the new repository
    --server-option
    option to transmit
    -4, --ipv4 use IPv4 addresses only
    -6, --ipv6 use IPv6 addresses only
    --filter object filtering
    --remote-submodules any cloned submodules will use their remote-tracking branch
    --sparse initialize sparse-checkout file to include only files at root
    rm: unknown option -- typescript/.git"