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.
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
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🙏
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!
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
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!
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! 💖💚💛
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.
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...
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
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.
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?
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
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!
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
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
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
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 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 👍
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.
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
`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"
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.
I learn so much extra stuff everytime i see your livestream. Thanks.
You're so advanced, CJ! Also, your effort in sharing in-demand knowledge is immense! Bless your heart!
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
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🙏
Keep up the great work! I used to be active in your Discord. I love how respectful you are! Awesome work, Cody!!
Your lifesaver!! Recently I was working on an express + typescript project I didn't find that much content for it 🙏
Great stuff as always, thanks CJ!
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!
Great bloke, great video, great all round! Thanks CJ, helped me a lot.
Amazing tutorial! thank you very much. I love your chilled style of coding. Hello to Colorado!
So so happy I have subscribed to your channel!!! I have learned really a TON thanks to your vids!
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
this is what i am searching. Thanks for sharing
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!
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! 💖💚💛
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.
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...
i'm also looking for it
Great video. Thank you very much, CJ. Take love💚
His explanation is awesome ✨
up to now. Your soft is great too!
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
With the latest version of nodemon you don't need to install ts-node separately.
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.
I learned a fucking lot. Respect for that awesome lesson!
learned content. Thnx
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
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?
totally makes sense, totally not gonna happen
Thank you so much man
event driven project with pubsub and message broker would be awesome!
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
Right on, right on!
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!
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
@@CodingGarden Thanks, CJ. I'll have a look for that video.
awesome content, thanks
what is name of theme extension you use?
Instead of zod, you should use super-easy-validator
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
Have you found any better solution?
Does somebody knows where's the next part of this video?
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
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.
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.
@@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 👍
Hey where is the config loader vid?
How does Zod compare to Mongoose?
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.
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. :/
nice video...wish you didnt skip over the mongodb setup though
You can read how to install mongodb here: www.mongodb.com/docs/manual/administration/install-community/
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
i see, i think my mongodb is not setup properly, having issues with creating /data/db. will get back to you
this step doesnt seem to be covered in mongodb documentation.
use MongoDB Atlas
do i hit the like bouton on this video? not yet ok done
I think it would be better to use a little background music. Personal preference 🥰
bro, do some distributed nodejs application, like distributed chat app and other things.
god dmnit why you all programmers love to name evrything "todo"
they do so because they want you to define your todos in that todo
`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"