Express JS with TypeScript - Setup, Examples, Testing

preview_player
Показать описание
*DISCLAIMER*

This is NOT a full in depth tutorial on Express JS. It is only designed to walk you through the setup process of installing TypeScript, getting it up and running with Express, and show you examples of type annotating arguments. I have also added other examples with Unit Testing & Integration testing with Jest and ts-jest.

I highly recommend you use this as a way to learn how to setup a TypeScript project for Express, and then slowly migrate over your code. Many of the concepts covered in my Express JS Full Course can easily be translated over once you get the idea of what to type annotate.

Support the Channel:

Connect with me:

0:00 - Project Setup
3:00 - Install Typescript
9:44 - Configuring TypeScript
13:00 - Compile TS Files
16:30 - Nodemon with Typescript
20:27 - Basic Type Annotations
35:08 - Type annotate Request Body
41:22 - Type annotate Query Parameters
43:41 - Type annotate Route Parameters
44:38 - Type annotate Response Body
51:06 - Extend Request Interface
54:50 - 3rd Party Libraries with TS
59:45 - Unit Tests with Jest and TS
1:08:25 - Integration Tests with Supertest
1:20:45 - Integration Tests
Рекомендации по теме
Комментарии
Автор

I have been waiting for this tutorial. Here we are. Thank you very much.

naddulidaniel
Автор

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!

kncsmooth
Автор

This is very informative, thank you very much for the tutorial❤

rupeshthapa
Автор

Next tutorial can be a complete monorepo (like turborepo) with this stack, bonus add dockerization and deployment as well. Thanks for the amazing content.

ayushshende
Автор

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!!!

sayeddileri
Автор

Great tutorial. Helped me a lot, thanks man 👍

impulseimp
Автор

U r best, hello from Kyrgyzstan, really appreciate ur videos 👍

malikkadyraliev
Автор

awesome tutorial. Thanks for the video

riyad-appscode
Автор

Thank you very much!

1:14:55
import express from 'express';

let app: ReturnType<typeof express>;
should work as well.

maximoignacio
Автор

Hey Anson, love your videos. Would you consider making a tutorial for fastify ?

AdnanDev-suno
Автор

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

igmtink
Автор

When are you going to upload an advance ExpressJs tutorial?
Thanks for this awesome tutorial 💚

iUmerFarooq
Автор

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

ErrorCodes
Автор

I hope you will make a live stream again with a program that is stronger than chat🌺

mahmoudnada
Автор

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?

RobertMcGovernTarasis
Автор

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

deathscythe
Автор

Thanks for rich content .
I just want to ask how you learn these concept like nestjs and other along with best practices any sources?

masadsummair
Автор

1:05:46 how to differentiate one request to others?

jayjaayjaaay
Автор

I don't understand when to use express-serve-static-core v/s express

prerakhere
Автор

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

sdawdwadaufyuaiudi