Set up NodeJs Express with Typescript

  • typescript — to be able to use tsc command.
  • touch-cli — to be able to implement the touch command for Node.
npm init -y
yarn add -D typescript express ts-node nodemon @types/node @types/express
  • typescript — to code typescript in the project.
  • express— to make the route for api request.
  • ts-node— to be able to run node app in typescript directly without the precompilation.
  • nodemon— to watch the server and rerun when the code changes.
  • @types/node— to be able to use custom typescript types for node.
  • @types/express— to be able to use custom typescript types for express.
mkdir src && cd src && touch app.ts
  • node dist/app.js — to run the node app in javescript.
  • nodemon src/app.ts — to run the node app in typescript.
  • tsc -p . — to compile the typescript.

 by the author.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cheulong Sear

Cheulong Sear

3 Followers

Frontend Developer at Seven Peaks Software, looking to learn new thing and language enthusiast. ^^