![]() ![]() In the nodemon.json file, the command for execution is currently ts-node -r tsconfig-paths/register src/main.ts. Instead of using ts-node directly (which is what we do for a lot of Typescript projects), we should rather start up node normally and register the ts-node module. The next step is to configure our package.json and nodemon.json files to allow for debugging. You'll notice that I bind port 9229 in my docker-compose.yaml file, this will be very applicable in the next steps so don't forget it! For future comparison, this is what the package.json and nodemon.json files look like in the backend folder before I set up the debugger, Enabling the Debugger in a Typescript ProjectĬool so we're set up with the docker-compose.yaml and Dockerfile and if you run docker-compose up -build you should see the system build and start up. So currently, my docker-compose.yaml and Dockerfile look as follows, You'll also see a devops folder where I keep the docker-compose.yaml file and the Dockerfile that should be used to build the backend code.įinally, I bind the backend/src directory into the docker container so that changes are picked up by nodemon during development and there's a quick project rebuild and restart without having to restart the docker container. I'm using a nest project and I've placed the code into a backend folder. As long as you have docker and docker-compose installed, it should all work! If you'd like to follow in the example, you can clone the GitHub repository. I've used nest as our framework since that's what is most applicable in our use cases. This article outlines how to set up debugging in a Typescript project that runs using docker containers. The tutorials were great but I couldn't find one that explained the process from start to finish, this article was what I worked off to get to this answer. ![]() So I started reading around and found that there are ways to bind to the debug ports for node projects. This means that the current solutions out there won't work for us, unless we want to run half of the stack through docker-compose and the other half directly on our PCs. Furthermore, we use docker-compose, to set up the full stack for local development. We use docker for our development environment to ensure that there is a fast setup. The problem is that that solution assumes we are running the application directly off our PCs. It's pretty straight forward, all you have to do is set up the execution script in Webstorm (or any IDE really) and you're good to go. WebStorm is aware of CommonJS module structure and suggests proper auto completion options:ĭevelop your Node.JS applications with pleasure!ĭownload WebStorm for your platform from this project EAP page.I've recently been looking at how people debug Typescript applications. Run / debug parameters can be tweaked for the created run configuration. Although NodeJS path is auto-detected, it’s possible to change it by editing the “Default” configuration.Īfter you’ve run the correctly created configuration, it is possible to debug Node app using breakpoints, stepping, expressions evaluation, etc. The easiest way to start is right from the editor popup menu: There are several ways to run or debug Node.JS app script. This setting is needed for completion, validation and debugging of standard NodeJS symbols. Otherwise you can always download Node.JS JavaScript source files from (e.g. If you have Node.JS installed from sources, specify its location there. To do that, click the icon on the toolbar. ![]() Initially, you’ll need to configure the location of Node.JS JavaScript files in the IDE. ![]() The same steps apply for PhpStorm 3.0 EAP or IntelliJ IDEA 11 EAP with Node.JS plugin installed. This is a simple tutorial on how to get started with Node.JS development in WebStorm 3.0 EAP. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |