Express JS with TypeScript - Setup, Examples, Testing

  Рет қаралды 48,285

Anson the Developer

Anson the Developer

Күн бұрын

Пікірлер: 86
@kncsmooth8737
@kncsmooth8737 10 ай бұрын
Your clear explanations, detailed examples, and thorough coverage made it a breeze to follow along and understand. I truly appreciate the effort you put into creating such valuable content. Looking forward to more tutorials from you in the future! Keep up the fantastic work!
@ansonthedev
@ansonthedev 10 ай бұрын
Thanks a lot! I do try my best when making vids like these, so to hear stuff like this is very much appreciated. :)
@naddulidaniel2630
@naddulidaniel2630 10 ай бұрын
I have been waiting for this tutorial. Here we are. Thank you very much.
@ayushshende4290
@ayushshende4290 9 ай бұрын
Next tutorial can be a complete monorepo (like turborepo) with this stack, bonus add dockerization and deployment as well. Thanks for the amazing content.
@sidpd
@sidpd Ай бұрын
Man, I really appreciate the work you're doing! The content you're creating is incredible, especially with how you dive into the finer details. Like, there's no good video on KZbin covering annotations and TypeScript setup with Express, and you explain even the smallest things-like when to use `npx` and when not to. Honestly, you're an amazing teacher, and man you own my respect. Bruh, this is some solid intermediate-level content! We definitely need more videos like this. They really help us get a better idea of writing clean code. Thanks again for all the effort you put into these!
@maximoignacio6959
@maximoignacio6959 9 ай бұрын
Thank you very much! 1:14:55 import express from 'express'; let app: ReturnType; should work as well.
@Daniguy-p1b
@Daniguy-p1b 3 күн бұрын
for this typescipt with express first I visited your channel ☺....thanks a lot brother
@ourlifesgonnabesweetassugar
@ourlifesgonnabesweetassugar 2 ай бұрын
Wabhhh this channel is gold man, why i never see till now man
@codingacumen4536
@codingacumen4536 Ай бұрын
53:51 if your index.d.ts fiile is not executing make sure to include it in the tsconfig.json else you will not get the custom field
@sayeddileri3461
@sayeddileri3461 10 ай бұрын
Thank you so much Anson for this I am currently diving into testing and this is just perfect to help me get started. Thank you!!!
@ansonthedev
@ansonthedev 10 ай бұрын
Glad to hear that. You're welcome. :D
@fabiospinelli4179
@fabiospinelli4179 3 ай бұрын
Thank you very much for this video! I was a bit lost trying to set up TypeScript properly.
@EpistemicFomo
@EpistemicFomo 15 күн бұрын
So incredibly helpful! Thank you a lot!
@rusted.dreams
@rusted.dreams 3 ай бұрын
I was stuck in a bug where ts-node wont run and say couldn't recognize the file type '.ts' then I found out I was using type: moule in the package.json file which was causing the issue. I then removed it and it worked fine. I don't know there's an open issue in the ts-node repo about not working with module type!
@johnattaiyinusa5766
@johnattaiyinusa5766 10 ай бұрын
Great job, Anson
@RatherBeCancelledThanHandled
@RatherBeCancelledThanHandled 8 ай бұрын
Explained clearly ; well done 👍
@kkbejoy
@kkbejoy 2 ай бұрын
Hey Anson.. Really useful one.. Thanks a lot for creating such beautiful content...
@malikkadyraliev4871
@malikkadyraliev4871 10 ай бұрын
U r best, hello from Kyrgyzstan, really appreciate ur videos 👍
@ansonthedev
@ansonthedev 10 ай бұрын
Thank you :)
@rupeshthapa8891
@rupeshthapa8891 9 ай бұрын
This is very informative, thank you very much for the tutorial❤
@SunwarulBERI
@SunwarulBERI 7 күн бұрын
Helped a lot. Thanks. Subscribed!
@ミンテヨン
@ミンテヨン 2 ай бұрын
hello. Thank you for the great lecture. I have one question. If I write return before res.status in the handler, an error occurs in the router. Can you tell me why?
@impulseimp1035
@impulseimp1035 7 ай бұрын
Great tutorial. Helped me a lot, thanks man 👍
@iUmerFarooq
@iUmerFarooq 10 ай бұрын
When are you going to upload an advance ExpressJs tutorial? Thanks for this awesome tutorial 💚
@ansonthedev
@ansonthedev 10 ай бұрын
It's in the works. Thank you!
@emnznlg
@emnznlg 2 ай бұрын
Hello, thanks for the video. It's amazing. Can you please let me know what font and which theme did you use in this video?
@Error404Codes
@Error404Codes 10 ай бұрын
i got my server down when i declare the index.d.ts for extend request interface , the controller file did not show erro and ts knows the property but server goes down Property 'CustomField' does nto type 'Request
@jamesc3064
@jamesc3064 6 ай бұрын
There's something about the way that the Request interface is extended globally that nodemon doesn't like. You can work around it using "start:dev": "nodemon --exec 'tsc && node dist/index.js' --ext ts" in your package.json
@gempf
@gempf 4 ай бұрын
I have the same problem...
@sdawdwadaufyuaiudi2148
@sdawdwadaufyuaiudi2148 8 ай бұрын
almost every coures I find on youtube use any, only you explain what going in generic 40:17 ,thank . Is there any cheatsheat TypeScript for express,I can only cheatsheat for reactjs,it kinda suck
@Luke-Barrett
@Luke-Barrett 4 ай бұрын
With the latest version of nodemon you don't need a separate install of ts-node. Nodemon will do the same thing for you.
@jupiterjones1836
@jupiterjones1836 Ай бұрын
Great work sir. THis helped me to use typescript with express seamlessly. Please, I would want to know what font you are using on this vscode. It is really nice. I want to use it too.
@Jens1243
@Jens1243 9 ай бұрын
Awesome tutorial!
@SamOdiagbe
@SamOdiagbe 4 ай бұрын
what theme is that, that's a pretty bold theme
@Boochie-n9c
@Boochie-n9c 7 ай бұрын
Super helpful, thank you!
@jayjaayjaaay94
@jayjaayjaaay94 7 ай бұрын
1:05:46 how to differentiate one request to others?
@riyad-appscode
@riyad-appscode 10 ай бұрын
awesome tutorial. Thanks for the video
@ansonthedev
@ansonthedev 10 ай бұрын
You're welcome. Thanks! :D
@amatutoriel
@amatutoriel 6 ай бұрын
Please your vs code extension ?
@AdnanDev-su5no
@AdnanDev-su5no 6 ай бұрын
Hey Anson, love your videos. Would you consider making a tutorial for fastify ?
@kumarchandresh0
@kumarchandresh0 4 ай бұрын
Which theme are you using?
@paolo8114
@paolo8114 16 күн бұрын
Hi @Anson. Express does not let me overload response parameter with my own type. When setting my own interface as returned type, and trying to return it, im getting error that : The last overload gave the following error. Argument of type '(req: Request, res: Response) => Promise' is not assignable to parameter of type 'Application'. Even chatGPT could not solve it ;) Maybe u can outsmart it?
@letsspeakwithlearnenglish6371
@letsspeakwithlearnenglish6371 2 ай бұрын
Great man, what extension are you using for intelligence.
@masadsummair
@masadsummair 9 ай бұрын
Thanks for rich content . I just want to ask how you learn these concept like nestjs and other along with best practices any sources?
@ansonthedev
@ansonthedev 9 ай бұрын
When you're a beginner, it's fine to refer to KZbin videos or courses on platforms like Udemy. When you become more advanced, you learn how to refer to documentation and build intuition with your experience.
@deathscythe3124
@deathscythe3124 8 ай бұрын
How come you didn’t get an error when you name your user.ts router a const route then call it in index.ts as import userRouter. Im confuse. Please explain it to me
@RobertMcGovernTarasis
@RobertMcGovernTarasis 10 ай бұрын
Very clear, thank you. You’ve now got my toes wet with typescript. 1 question, how come when you ran npm run test:e2e it only ran 1 test for you, but for me it’s running both the e2e test, and the handler test?
@ansonthedev
@ansonthedev 10 ай бұрын
My guess would be you may have forgot to set the flag for the test:e2e script to run tests only in the src/e2e folder. By default it will run all .test.ts or .spec.ts test files.
@ashutoshkummarr
@ashutoshkummarr 5 ай бұрын
i'm getting unknown file extension with ts-node ,my type is set to "type" : "module
@codewithahk
@codewithahk 4 ай бұрын
//tsconfig.json { "compilerOptions": { "target": "es2016", "module": "commonjs", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true } } //package.json { "name": "backend", "version": "1.0.0", "main": "index.js", "scripts": { "build": "tsc", "start": "node ./dist/index.js", "dev" : "nodemon ./src/index.ts" }, "author": "Ahmad Hassan Khan", "license": "ISC", "description": "", "devDependencies": { "@types/cors": "^2.8.17", "@types/express": "^4.17.21", "@types/node": "^22.5.4", "express": "^4.19.2", "nodemon": "^3.1.4", "ts-node": "^10.9.2", "typescript": "^5.5.4" }, "dependencies": { "cors": "^2.8.5", "jsonwebtoken": "^9.0.2" } }
@tenshin_yozora
@tenshin_yozora 3 ай бұрын
yoo I got the same case, were you able to resolve this?
@fola_azeez
@fola_azeez 5 ай бұрын
This is amazing thank you so much.
@igmtink
@igmtink 9 ай бұрын
can you make a tutorial how to setup both nextjs + expressjs with typescript sir? like nextjs for frontend and expressjs with typescript for backend just a simple to-do or any
@mohiwalla
@mohiwalla 10 ай бұрын
Good job 👍👏
@ansonthedev
@ansonthedev 10 ай бұрын
Thanks! :D
@parth_patel2933
@parth_patel2933 4 ай бұрын
amazing video. thanks a lot!
@ayMillmusic
@ayMillmusic 4 ай бұрын
Legend!
@mahmoudnada2120
@mahmoudnada2120 9 ай бұрын
I hope you will make a live stream again with a program that is stronger than chat🌺
@gunasekarant6498
@gunasekarant6498 8 ай бұрын
Awesome one Thank you so much
@ansonthedev
@ansonthedev 8 ай бұрын
You are welcome!
@aspirinemaga
@aspirinemaga 4 ай бұрын
Thank you so much for sharing
@prashlovessamosa
@prashlovessamosa 10 ай бұрын
Thanks Anson.
@chamaraweerasinghe3909
@chamaraweerasinghe3909 9 ай бұрын
greate content keep up the good work
@maxmaul-pr2og
@maxmaul-pr2og 5 ай бұрын
Hey anson, i was keeping up with your tutorials and they are very helpfull, i was wondering if you could make a class in nodejs rest api architecture?, like controller services and such, couldnt find any good tutorials online, mostly artricles with weak examples
@ansonthedev
@ansonthedev 5 ай бұрын
By that point you’re better off just using Nestjs, which was designed with this architecture in mind. Which I also have plenty of videos on my channel.
@govindamishra3746
@govindamishra3746 3 ай бұрын
Bro using Javascript classes in 2024
@ansonthedev
@ansonthedev 3 ай бұрын
@@govindamishra3746 and there’s absolutely nothing wrong with that.
@abhayshaw1875
@abhayshaw1875 9 ай бұрын
Hey can we have a video on an opionated one :adonis js??
@marcschiavone9549
@marcschiavone9549 9 ай бұрын
I believe it doesnt make much sense since here they explain the whole typescript + express setup and adonisjs is already typescript ready.
@nizarelfennani7477
@nizarelfennani7477 4 ай бұрын
What font are you using there?
@jupiterjones1836
@jupiterjones1836 Ай бұрын
I am also curious about the font
@mythmaker6155
@mythmaker6155 9 ай бұрын
I am sorry to ask you this. but I am new to Express with TypeScript. i worked with django. But for expanding my tech stack i am learning to express the best way. One thing i loved in django(Django-ninja) was automatic API documentation. is there any way to achieve similar functionality in Express? I did search API documentation with Express but all I find is manual documentation. If there is any way to automatically generate documentation with Joi or TS interface it would be really helpful. BTW love the video. it got me started TS with Express
@ansonthedev
@ansonthedev 9 ай бұрын
There is Swagger, not sure about it being automatic, but it does provide documenting your APIs for you.
@prerakhere
@prerakhere 8 ай бұрын
I don't understand when to use express-serve-static-core v/s express
@codewithahk
@codewithahk 4 ай бұрын
Typically, you won't directly import or interact with express-serve-static-core. It is used internally by Express. However, if you are writing TypeScript or creating TypeScript types for your Express application, you might import types from express-serve-static-core, as it contains TypeScript definitions for core Express objects.
@codewithahk
@codewithahk 4 ай бұрын
if you're not doing any low-level Express manipulation or using TypeScript, you can ignore express-serve-static-core and focus on using express
@smartdriver2990
@smartdriver2990 10 ай бұрын
Wow, interesting 🎉
@thezeeshann
@thezeeshann 4 ай бұрын
Bro can you please make a video on typescript with react, and react query humble request 😢🙏
@ansonthedev
@ansonthedev 4 ай бұрын
I have a video on react query already that will be uploaded soon.
@jellyfish1772
@jellyfish1772 9 ай бұрын
Thank you so much ..
@ansonthedev
@ansonthedev 9 ай бұрын
You’re welcome
@nithya4860
@nithya4860 10 ай бұрын
Wow!
@devfabien
@devfabien 9 ай бұрын
This is an amazing tutorial. I would like to seek your recommendation; based on what you showed in tutorial most in the part of e2e test what is your point of view in using `App` type from supertest/types instead of assigning variable app to `Express` type. kzbin.info/www/bejne/eJaaiWmHf9qmgKM
@ansonthedev
@ansonthedev 8 ай бұрын
I used "Express" because that's the inferred type from the express() function call that is returned. Never knew there was an App type. But I never had any issues using the Express type.
@FreeFire-kingfire
@FreeFire-kingfire Ай бұрын
bro, what font are u using?
How To Use TypeScript With Express & Node
17:05
Colt Steele
Рет қаралды 76 М.
I Didn’t Believe that AI is the Future of Coding. I Was Right.
6:55
Sabine Hossenfelder
Рет қаралды 634 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Learn TypeScript Generics In 13 Minutes
12:52
Web Dev Simplified
Рет қаралды 296 М.
How To Dockerize Nest JS APP (Node JS, Mysql PHPMyAdmin)
1:17:10
Express JS #9 - Middleware
21:42
Anson the Developer
Рет қаралды 11 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
Express JS #20 - Unit Testing with Jest
1:24:40
Anson the Developer
Рет қаралды 15 М.
React State Management with Zustand & TypeScript
1:04:35
Anson the Developer
Рет қаралды 6 М.
Typescript API in NodeJS / Express in Depth [Part 1]
38:10
The Nerdy Canuck
Рет қаралды 15 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН