Anson demonstrates how to set up a TypeScript project with Express, annotate arguments, and write tests using Jest.
*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.
Link to Express JS 8 Hour Course: youtube.com/watch?v=nH9E25nkk3I
Code Repository: github.com/stuyy/express-typescript-example
Support the Channel:
Become a Member: youtube.com/ansonthedeveloper/join
Become a Patreon: patreon.com/stuyy
Buy me a Coffee: ko-fi.com/anson
Donate on Streamlabs: streamlabs.com/ansondevacademy/tip
Donate on PayPal: paypal.me/ansonfoong
Connect with me:
Twitter: twitter.com/ansonthedev
Discord: discord.gg/Gd5fAEJDQD
GitHub: github.com/stuyy
Twitch: twitch.tv/stuy
- Project Setup
- Install Typescript
- tsconfig.json file
- Configuring TypeScript
- Compile TS Files
- Nodemon with Typescript
- Basic Type Annotations
- Type annotate Request Body
- Type annotate Query Parameters
- Type annotate Route Parameters
- Type annotate Response Body
- Extend Request Interface
- 3rd Party Libraries with TS
- Unit Tests with Jest and TS
- Integration Tests with Supertest
- Integration Tests
Why it's here
1 person recommends this
What people say. Recommended as a helpful video guide for setting up Express with TypeScript.
r
u/rozeluxe08in r/typescript • Recommends
On “JS TO TS ”
Did you read the typescript handbook? If not, that's where you're supposed to start. TS Handbook
Using TS with Node/Express shouldn't be that different from what you learned from the handbook. Express has types available to install in a project.
Don't have a recommended blog, but I used to watch Anson in Youtube. Here's the Express + TS vid.