怎么在vscode中调试_在vscode中调试nestjs

怎么在vscode中调试

This article will take a look at three different techniques for debugging a NestJS application with VSCode.

本文将介绍使用VSCode调试NestJS应用程序的三种不同技术。

For a quick introduction to NestJS, check out this article.

有关NestJS的快速介绍, 请参阅本文 。

Visual Studio Code, or VSCode, is a lightweight source code editor with cross-platform support that boasts an impressive variety of features. Among these features is excellent tooling for debugging applications, including built-in support for Node.js and TypeScript.

Visual Studio Code或VSCode是一种轻量级的源代码编辑器,具有跨平台支持,并具有多种功能。 这些功能中包括用于调试应用程序的出色工具,包括对Node.js和TypeScript的内置支持。

While the NestJS documentation is comprehensive, one of the things that it currently does not cover in-depth is debugging.

虽然NestJS文档非常全面,但目前尚无法深入介绍的内容之一就是调试。

Fortunately for us, VSCode makes it very straightforward to debug both your NestJS application code and tests written using the Jest testing framework. All that’s required is a little bit of tuning.

对我们来说幸运的是,VSCode使调试NestJS应用程序代码和使用Jest测试框架编写的测试变得非常简单。 所需要做的只是一点点调整。

With that in mind, let’s dive in.

考虑到这一点,让我们开始吧。

方法1:启动配置 (Approach #1: Launch Configuration)

The first approach relies on a launch.json file included in a .vscode/ directory in the root of your workspace.

第一种方法依赖于工作区根目录.vscode/目录中包含的launch.json文件。

This JSON file provides configuration information that VSCode uses while figuring out how to debug your application correctly.

此JSON文件提供VSCode在确定如何正确调试应用程序时使用的配置信息。

Check out these docs for more on configuring a launch.json fil

你可能感兴趣的:(debug)