3:02 The "moduleResolution: node" was deprecated, so instead using "node" it's helpful use "NodeNext" or leave without definition. Awesome tutorial, you helped me a lot!
I just completed this video, I can say confidently that it's an outstanding video, it has skyrocketed my knowledge in node, and my ability to create REST API, structure my directories correctly, and lots more. Thank you so much Antonio🙏
As a front end developer, I finally finish This REST API tutorial in a week. Great Great! Thank you very much! I will conquer all your courses One at a time! Really having fun coding with you Antonio!
@@codewithantonio hello Antonio! BIG THANKS for thios video, but i have a question. why are you using http here, when u can just put app.listen and server is going to work? im not blaming, jsut cant get it
This is an outstanding video. Most of my work has been with Nestjs and postgres, but this gave me a clear perspective on a different approach to handle the same REST endpoints. earned yourself a loyal sub!
Hi Antonio. I found your channel recently and completed coding the REST API. I learnt alot and amused with the way you explain & code all the stuff. I hadn't found a channel like yours before. However It's all super clean❤ You deserve more followers than you have rn. Keep up the great work🤍🥂 Lots of love from Sri Lanka🇱🇰
I want to show my appreciation for your useful video,I highly recommend to every person who is looking for do complete CRUD with Node,this video is so handy and you can get whatever you need for your REST API.
Wow~~ This is the course I was looking for. I wanted to see a lecture made with node typescript thank you. I should have seen this lecture sooner. I used google translator.
Thank you so much for watching my first tutorial. All the code is available here github.com/AntonioErdeljac/ts-node-mongo-rest-api-tutorial, and in the description. If you noticed any mistakes, bugs or wish for anything to be improved, please write in the comments below, I would be happy to improve! ❤
I've had having some trouble getting my code to run properly. My main two issues were with user login and checking if an email already exists in the database. My solution was to import the 'User Model' into my controller file and use the findOne method. That little fix did the trick. I'm a junior software developer, so don't get mad at me, seniors software enginnering! lol!
Great tutorial. For those that didn't follow it exactly, I had strict: true in my tsconfig.json. This caused TS to complain about the authentication controller file. user.authentication and user.authenticaion.salt could be null or undefined. To fix, just add a few more checks in: if (!user) statement. It should be something like: if (!user || !user.authentication || !user.authentication.salt) that solved it for me.
Pretty interesting stuff. I was looking for Graph QL but landed on this video and couldn't quit) A great video for baking a boilerplate for future projects. Thanks.
For the next videos, Can you please Add mongodb all relationships such as one to one, one to many and many to many. It's a topic in which I have lot interest. Thanks
@@RebaiMoez There can be relations between collections in document DBs. While it is advisable to denormalize, there are certainly scenarios where you would query a collection by FK.
Good tutorial but it might be more helpful to also mention what certain parts of the code are doing and why they're there. At one point, a line is added that is "extremely important" or else the code will not work. It would be nice to get some explanation about why that is exactly.
Great video! i was struggling with back-end and this really cleared my mind. What would you recommend when it comes to testing? A video focused on TDD with typescript would be great :)
This really was a great tutorial. 😀🙏🏼 The front-end counterpart tutorial to this (React, Next, or HTML/JS) should be short and quick, and would be extremely useful. Thanks!
Personally, I would not suggest it for beginners; there is little to no explanation and it might be quite daunting for those of you who are just getting started.
Want to get mentored by me? Apply at www.codewithantonio.com/mentorship Hi! I created a Discord channel where you can ask me any questions if you got stuck in my tutorials: discord.gg/SPEBvAz4Vd
Aspects of this no longer work with express 5, so if you are getting overload errors in your router files, you can downgrade to express 4.x.x or include next after res and req in the definition. Thanks for the tutorial!
At around minute 32 I get errors: user.authentication.salt, .password and .sessionToken are "possibly undefined". I checked my users.ts file and it seems to be exactly the same as yours. What do I have to do in order to make this error disappear?
One way woudl be to add an explicit guard check like so: if (!user || !user.authentication || !user.authentication.salt) { return res.sendStatus(400); }
Nice tutorial for this in typescript, for unknown reason the post is deleted, so i write again, haven't go throught it but just notice you still use bodyparser, since 4.0 express have already integrated it, so you don't need anymore and you can replace the middleware with express.json() :)
sir antonio can you make a masterclass for this, like "next-auth" like having a logic to implementing "email verification, password reset, otp, oauth provider, role base"
you cannot deploy server side applications like this API to netlify, unless you deploy it as serverless function. although you can easily deploy it to render. but render doesn't allow your server to run all the time it shuts down after 15s from last call, and it takes too long to restart and send back response when you call it again after 15 min. better alternative is vercel but you have to configure some files to be able to deploy an api to it.
Hi, Antonio! thx for a nice tutor! As a cpp backend dev (no experience in web) I'm wondering, why not use OpenApi notation for API declaration and sever creation?
i watch your videos they well put together with advanced development practice but can you do a more in depth explanation tutorial for some us are not following at some instance
good stuff i like the fact that you used typescript in the backend , the only thing that i maybe not fan of is the naming for the files too many index.ts and file structure im kinda lost , maybe a sperated files models/controllers/routes would be nice. since the more complexity we add to a certain project, the more files we have, it would be chaos. it maybe comes back to personal preference idk. overall good job ❤🔥❤🔥
Hello Antonio and thank you for the great content. I have watched until 33:41 (end of authentication) and I have some questions. 1) Isn't it better to use bcrypt instead of crypto for hashed passwords? 2) Isn't it better to use a .env file to save your passwords instead of using them directly in code? 3) Isn't it safer to use jwt instead of this session token? 4) Shouldn't the cookie and the token have expiration dates? 5) Like this is the authentication safe enough to use against common hacking attacks?
Hi there ! I would like to address a bug which I encountered while following this tutorial. If anyone is getting the following error in their app: Error: Cannot find module 'helpers' Require stack:.... Then you need to fix your imports from this - import { authentication, random } from "helpers"; to this import { authentication, random } from "../helpers"; For these '../' I spend a lot of time debugging. Thanks for the tutorial Antonio.
The thing about storing salts is a very old concept that was discarded, it discouraged, unless something has changed and i don't know, you just don't need to save it.
Thank you for pointing this out! I will take a look at my decisions in this video and see how it can be improved, I actually did not use salt as you said in my Netflix and Twitter tutorial, so you're probably right :)
3:02 The "moduleResolution: node" was deprecated, so instead using "node" it's helpful use "NodeNext" or leave without definition.
Awesome tutorial, you helped me a lot!
Did everything work for you? I'm getting a 400 Bad Request in postman when I'm trying to register a new user. 🤔
@@JoSh-yu6jt Make sure you send your request (through postman) in JSON format.
I've typed NodeNext on both
I just completed this video, I can say confidently that it's an outstanding video, it has skyrocketed my knowledge in node, and my ability to create REST API, structure my directories correctly, and lots more. Thank you so much Antonio🙏
As a front end developer, I finally finish This REST API tutorial in a week. Great Great! Thank you very much! I will conquer all your courses One at a time! Really having fun coding with you Antonio!
Thank you for watching the tutorial!
@@codewithantonio hello Antonio! BIG THANKS for thios video, but i have a question. why are you using http here, when u can just put app.listen and server is going to work? im not blaming, jsut cant get it
This is an outstanding video. Most of my work has been with Nestjs and postgres, but this gave me a clear perspective on a different approach to handle the same REST endpoints. earned yourself a loyal sub!
Glad it was helpful!
Hi Antonio. I found your channel recently and completed coding the REST API. I learnt alot and amused with the way you explain & code all the stuff. I hadn't found a channel like yours before. However It's all super clean❤ You deserve more followers than you have rn. Keep up the great work🤍🥂 Lots of love from Sri Lanka🇱🇰
best tutorial on API ts. clean and straight forward no bs. Thanks a lot.
Glad you like it!
Man, your videos are treasure. UA-cam should have added respect button. Thank you!
Glad you like them!
I want to show my appreciation for your useful video,I highly recommend to every person who is looking for do complete CRUD with Node,this video is so handy and you can get whatever you need for your REST API.
Wow~~
This is the course I was looking for.
I wanted to see a lecture made with node typescript
thank you.
I should have seen this lecture sooner.
I used google translator.
Glad you like it!
Your tutorial has been the most useful for me!
Very clean and crisp video Antonio, that's what a good dev and guide should do, gonna watch more content and learn from your channel.
Much appreciated!
Great video. It's just clean, easy to understand and straightforward. Thanks and keep it up 👍
Thank you a lot, glad it helped you!
perfect, I love this channel. Thanks to god, I discovered this channel
So happy to hear that!
I was able to run the findByIdAndUpdate even though it was not included at the video. Thanks for a very clear and smooth tutorial.
Glad it helped!
Thank you so much for watching my first tutorial. All the code is available here github.com/AntonioErdeljac/ts-node-mongo-rest-api-tutorial, and in the description. If you noticed any mistakes, bugs or wish for anything to be improved, please write in the comments below, I would be happy to improve! ❤
Nah bruv, error 404
Great Video Antonio. One quick thing for others, you don't need body parser as separate package with latest express (>v4), express inbuilts it
Thanks for the info!
I've had having some trouble getting my code to run properly. My main two issues were with user login and checking if an email already exists in the database.
My solution was to import the 'User Model' into my controller file and use the findOne method. That little fix did the trick.
I'm a junior software developer, so don't get mad at me, seniors software enginnering! lol!
Great tutorial. For those that didn't follow it exactly, I had strict: true in my tsconfig.json. This caused TS to complain about the authentication controller file. user.authentication and user.authenticaion.salt could be null or undefined. To fix, just add a few more checks in: if (!user) statement. It should be something like: if (!user || !user.authentication || !user.authentication.salt) that solved it for me.
Thank you for this video!! I am a backend noob and this guide helped me a lot! So glad that I came across your video.
Glad to hear it!
Thanks a lot for explaining so quickly. Wating for your vidoes. Love from Bangladesh.
Glad you like it!
Pretty interesting stuff. I was looking for Graph QL but landed on this video and couldn't quit) A great video for baking a boilerplate for future projects. Thanks.
So helpful Antonio, you're so great.
but remember that now body parser is deprecated
Great video - I love this video about nodejs typescript
Thank you a lot!
Very good. Waiting for more videos like these for Angular, Node(advanced), Flutter
I'm a newbie. It's really helpful. Thank you so much.
Glad you like it!
Thanks for this USEFUL REST API GUIDE
You are most welcome
For the next videos, Can you please Add mongodb all relationships such as one to one, one to many and many to many. It's a topic in which I have lot interest. Thanks
Thank you so much for the suggestion! I will make sure to put it on my list
MongoDb is no sql database so basically there’s no relation between collections
@@RebaiMoez There can be relations between collections in document DBs. While it is advisable to denormalize, there are certainly scenarios where you would query a collection by FK.
@@RebaiMoezactually it is possible to create relationships.
ua-cam.com/video/StrwQFdxudQ/v-deo.htmlsi=gJsfvd_ndHo_i5DU
Thanks a lot Antonio for the video. Learnt few new things like no jwt, storing token in the cookie.
Glad you like it!
Amazing API video. Very easy to understand and clean code to learn! Thanks Man!
Glad it was helpful!
Very simple and easy to follow along thank you amazing video
Glad it was helpful!
Thank You so much, really needed this
Glad it helped!
Thanks for sharing this great video.Learned a lot.
Glad it was helpful!
thanks for this tutorial, it made me a lot easier to setup TS with express and use it 😃😃
Glad you like it!
Very straight forward and easy to understand, thx
Glad you like it
Such an amazing tutorial. Thank you Antonio! 😍👋
I love your stuff. Keep up the great work. You're an amazing teacher and these simple tutorials are awesome.
Hello Antonio, really nice video. i loved
Glad you enjoyed it
Good tutorial but it might be more helpful to also mention what certain parts of the code are doing and why they're there. At one point, a line is added that is "extremely important" or else the code will not work. It would be nice to get some explanation about why that is exactly.
I full agree, this was my first video and I didn't really know what I was doing, thank you for the feedback!
i also felt same.
finally no error, thank you
great video. very helpful. thanks
great content with easy explanation.
Glad you think so!
Excellent Tutorial
Glad you liked it
EXCELLENTE sir! Thanks!
great project. thanks bro, i gonna put this on my portfolio
Thank you! Glad it helped you!
Very cool the way you handle the router!! You got a like and a follow!
Amazing wait for next video
Thank you a lot! New video is coming soon!
Great video! i was struggling with back-end and this really cleared my mind. What would you recommend when it comes to testing? A video focused on TDD with typescript would be great :)
Happy you liked the video! I will perhaps make a more in-depth tutorial about testing in the future
@@codewithantonio
Anticipating this @@codewithantonio
Hey Antonio, a video on TDD will be highly appreciated🙏❤
This really was a great tutorial. 😀🙏🏼
The front-end counterpart tutorial to this (React, Next, or HTML/JS) should be short and quick, and would be extremely useful. Thanks!
amazing, easy to follow and pleasant to listen.
Thank you very much :)
Loved this tutorial! Thanks a lot man!
Glad you like it!
You are a pro man.
Great video,, you explained it clearly,, i have subscribed
Thank you a lot!
omg I learned a lot from this video, thanks a lot!
Glad it was helpful!
Great Tutorial, thanks for nice tutorial 💌
You're welcome 😊
Personally, I would not suggest it for beginners; there is little to no explanation and it might be quite daunting for those of you who are just getting started.
Very true. Thought exactly the same.
I thought the same
I'm beginner but I understand pretty well I like it ❤
@arpan157 do you know any other good videos on express js?
But which is better ?
This or the simple express.js
amazing work really helped me a lot. Thank you
Glad to hear that!
Your content is good, keep create more content about nodejs with TS but in the real life, it will be great
Thank you!
You saved my life. Thanks
Happy I helped!
Want to get mentored by me? Apply at www.codewithantonio.com/mentorship
Hi! I created a Discord channel where you can ask me any questions if you got stuck in my tutorials: discord.gg/SPEBvAz4Vd
Mate this is awesome
Thank you so much!
Excellent explanation!
Thank you!
@@codewithantonio Oh! can you please tell me what VS Code theme you use? I just loved it....
@@sarfrazshah5158 Monokai Pro!
@@codewithantonio Thank you Sir!
Aspects of this no longer work with express 5, so if you are getting overload errors in your router files, you can downgrade to express 4.x.x or include next after res and req in the definition.
Thanks for the tutorial!
could you paste your code to see what you mean by including next after res and req, plss
create user returns 200. GOOD job!
Would really want to see a guide to building a REST API with TypeScript + MYSQL(Larvel) + Authentication
At around minute 32 I get errors: user.authentication.salt, .password and .sessionToken are "possibly undefined". I checked my users.ts file and it seems to be exactly the same as yours. What do I have to do in order to make this error disappear?
One way woudl be to add an explicit guard check like so:
if (!user || !user.authentication || !user.authentication.salt) {
return res.sendStatus(400);
}
@@JonnyCage77i can't even save please help me...
Bro did u fixed it if s how...??
And just like that I completed the tutorial successfully. Thanks for the video
Glad it helped
Good video, I would recommend to use the command [ npx tsc --init ] instead of creating the tsconfig.js from scratch.
Wow this tutorial really saves me cause I have a interview about it. If you have time, could you please do a MEAN/MERN based on this tutorial?
Thank you, very useful using ts
Glad it was helpful!
Do more backend tutorials !!
Will do in the future! Thank you for watching!
Great work, thank you @codewithantonio 🤗
excellent video I need videos for socials login🥰🥰
Thank you! If you are interested in NextJS, I have a couple of tutorials which do social login there
Can u please more videos on express Node backend and production deployment.
Thanks for the suggestion! I will look into it!
Great Video!
Thank you!
do you have any recomendations on where do I learn the basics os authentication and password encrypting?
Do we need the "mongoose.Promise = Promise;" line? and what does it do? thank you very much
Great great job! 😊
Awesome man, new follower, and if you create a paid course, I'm in for buying it 🤘🏽
Very happy you like my tutorial! :)
thank you for sharing!
My pleasure!
Great stuff! Many thx
Glad you like it!
thanks a lot Antonio ❤ can you create a video about handling role permission with middlewares to?
Thanks for sharing your knowledge.. I've got an error on the tsconfig.ts file the property "moduleResolution": "node",
^ The only one of these comments actually following along.
His TS Config is broken....
Thanks very much ❤❤❤
Excellent
what is the differences between httpServer.listen() and app.listen(), the first is using http modules, and express framework?
Nice tutorial for this in typescript, for unknown reason the post is deleted, so i write again, haven't go throught it but just notice you still use bodyparser, since 4.0 express have already integrated it, so you don't need anymore and you can replace the middleware with express.json() :)
sir antonio can you make a masterclass for this, like "next-auth" like having a logic to implementing "email verification, password reset, otp, oauth provider, role base"
Amazing video. Could you show us how to deploy it properly? Like on Netlify. Also, are u planning a React course in the near future? Thnaks
you cannot deploy server side applications like this API to netlify, unless you deploy it as serverless function. although you can easily deploy it to render. but render doesn't allow your server to run all the time it shuts down after 15s from last call, and it takes too long to restart and send back response when you call it again after 15 min. better alternative is vercel but you have to configure some files to be able to deploy an api to it.
Hi, Antonio! thx for a nice tutor!
As a cpp backend dev (no experience in web) I'm wondering, why not use OpenApi notation for API declaration and sever creation?
i watch your videos they well put together with advanced development practice but can you do a more in depth explanation tutorial for some us are not following at some instance
good stuff i like the fact that you used typescript in the backend , the only thing that i maybe not fan of is the naming for the files too many index.ts and file structure im kinda lost , maybe a sperated files models/controllers/routes would be nice. since the more complexity we add to a certain project, the more files we have, it would be chaos. it maybe comes back to personal preference idk. overall good job ❤🔥❤🔥
thank u so much
Happy to help
Hello Antonio and thank you for the great content. I have watched until 33:41 (end of authentication) and I have some questions.
1) Isn't it better to use bcrypt instead of crypto for hashed passwords?
2) Isn't it better to use a .env file to save your passwords instead of using them directly in code?
3) Isn't it safer to use jwt instead of this session token?
4) Shouldn't the cookie and the token have expiration dates?
5) Like this is the authentication safe enough to use against common hacking attacks?
It is better, Its safer and JWT Is better and cookies do have expiration dates.
Hi there !
I would like to address a bug which I encountered while following this tutorial.
If anyone is getting the following error in their app:
Error: Cannot find module 'helpers'
Require stack:....
Then you need to fix your imports from this -
import { authentication, random } from "helpers";
to this
import { authentication, random } from "../helpers";
For these '../' I spend a lot of time debugging. Thanks for the tutorial Antonio.
Great video, thanks a lot
Thank you!
The thing about storing salts is a very old concept that was discarded, it discouraged, unless something has changed and i don't know, you just don't need to save it.
Thank you for pointing this out! I will take a look at my decisions in this video and see how it can be improved, I actually did not use salt as you said in my Netflix and Twitter tutorial, so you're probably right :)
Great video. Why you merge two objects and using identity key in isAuthenticated method in middleware? Thanks in advance.
Tutorial is great! Thanks alot. Just some thing to note, I find that you sometimes just say WHAT you are doing but you don't explain WHY.
Thanks for the tip!
why use MongoDB for users? isn't it better to use a relational DB like PostgreeSQL with prisma so users can have relations?
I'm stuck on "user.authentication possibly 'undefined' " it shows an error
Make sure your "tsconfig.json" filename is spelled correctly.