How to Write Node.js Applications in Typescript
And make it easier to maintain them while creating fewer bugs
In this article, I’m going to show you how to set up a simple development environment for writing a Node.js application in TypeScript.
Let me start by saying that there probably are a thousand or more different ways you can create Node.js applications in TypeScript. I’m just going to show the way I like to do it myself.
If you don’t feel like reading this entire article, you can find my starter project here: https://github.com/FreekMencke/node-typescript-starter. It contains some extra features that we’re not going to discuss in this article.
Like I said before, there are a lot of different ways you can do this. I like to use Webpack for my TypeScript projects. But first things first. Let’s start by creating a
You can generate a
package.json by using the
npm init command or you can copy paste the code below and change it.
src/ directory with a
information-logger.js file with some Node.js functionality: