Can you please explain the purpose of the '--watch' and '--debug' options in the '

After going through the documentation regarding the nest command, I found the following information:

https://docs.nestjs.com/cli/scripts

The document states that the following code snippets must be added to the package.json:

"build": "nest build",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",

I am curious about the functionalities of the --watch and --debug options mentioned here. Can you explain what they do?

Answer №1

As per the nestjs start documentation, here are the main functionalities;

--watch

Enable watch mode for live-reload
Alias -w

Any changes made to source files will trigger automatic compilation without manually running npm run start after each change, making development smoother.

For instance, modifications to typescript files (saved or git-related) within src will be compiled into javascript files in dist based on your configuration.

--debug

Activate debug mode with --inspect flag
Alias -d

The use of --debug involves running the node process utilizing the --inspect flag for native debugging via an IDE. By connecting to the node debug address and port (usually 127.0.0.1:9229), breakpoints can be utilized for pausing execution.

*Note that current implementations may require the --inspect-brk flag for breakpoints, as indicated by ongoing issues with the nestjs implementation here.

Some IDEs like VS Code offer an auto-attach feature which negates the need for --debug and simplifies setup, though it may not be as efficient when working on multiple simultaneous node applications.

Answer №2

Simply put, when you use --watch, the terminal will remain open to monitor for any modifications in files and then automatically refresh the server. On the other hand, with --debug, additional messages are displayed in the console (such as information or warnings), providing assistance in troubleshooting.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to proceed with iteration

I am encountering an issue with the ng-repeat directive while working on it. As a beginner, I am struggling to resolve it on my own. var myModule = angular.module("myFirst",[]); myModule.controller("cont", function($scope){ var employees = [ {name: "Ma ...

Develop a plugin architecture using JavaScript and Node.js

Here is a basic implementation using node.js with express: var express = require('express'); var app = express(); app.get('/', function(req, res){ res.send('Hello World'); }); app.listen(3000); I am interested in creatin ...

Understanding the mechanism behind how the import statement knows to navigate to the package.json file

I find myself stuck in bed at the moment, and despite numerous Google searches with no clear answers, I have chosen to seek help here. Could someone please clarify how scoping works when using import in TypeScript and determining whether to check the pack ...

Incorporate variable key-value pairs into a JavaScript array or object

Is it possible to add a key value pair to an existing JavaScript associative array using a variable as the key? I need this for JSON encoding and prefer a simple solution over using plugins or frameworks. ary.push({name: val}); In the above code snippet, ...

What is the process for showcasing a local notification within my application?

Here is the code snippet I am working with: import { LocalNotifications } from '@ionic-native/local-notifications'; @Component({ selector: 'app-home', templateUrl: 'home.page.html', styleUrls: ['home.page.scs ...

attempting to communicate with Postman but encountering an error in the process

Upon attempting to send a request through Postman, I encountered an error. Nodemon is operational and the server is active in the terminal. index.server.js file //jshint esversion:6 const express = require("express"); const env = require("d ...

Within Blade, Laravel and Vue components are able to communicate by sharing data from one component to another

Is it possible to achieve this task? Here is the scenario: I have a left navbar displaying membership status (active/inactive). Once the payment gateway receives the payment, a webhook is triggered via Paddle(Laravel Paddle API). During the webhook proc ...

Using React Inline Styles to Set a Background Image

I am facing an issue with accessing a static image to use as a background within the backgroundImage property in React. I have hit a roadblock and need some guidance on how to proceed. My initial thought was that it could be achieved by following these st ...

Sending blank data using ExpressJS ajax feature

I am encountering an issue while trying to send JSON data to my server as the POST requests are coming through with empty bodies. Below is the TypeScript code I am using on the front end: function sendData() : void { console.log("Sending data..."); var na ...

The call to Contentful's getAsset function resulted in an undefined value being

I am facing a challenge while trying to fetch an asset, specifically an image, from Contentful and display it in my Angular application. Despite seeing the images in the Network log, I keep encountering an issue where the console.log outputs undefined. Any ...

Can CSS transitions be synced up to happen simultaneously?

Here is a snippet of code showcasing CSS transitions applied to the height property. It seems that CSS transitions work asynchronously, but I am curious if there's a way to make them synchronous without using jQuery or other methods. CSS: .animated ...

Allow the div to display based on the existence of a value

I need to display a div based on the availability of tickets. The template I am using is as follows: if availableTickets is null or zero, it should be shown as, <div ng-if="DetailEvent.listing?.availableTickets == 0"> <div > No tickets ...

I am looking to dynamically alter the CSS background URL using JavaScript

Currently, I am looking to update the background image url using JavaScript. Most tutorials I've come across involve having the image downloaded on the desktop and then providing its path. However, in my scenario, the user will input an image link whi ...

Insert the <span> element within the <a> element with the help of Jquery

I am attempting to insert a span tag inside .block-leftnav ul li .parent a, however, instead of adding the tag after only the .parent a, jQuery is adding the span tag after every href tag on my page. Below is the code I am using to achieve my desired outc ...

Preventing Angular button click when an invalid input is focused out

Here is a Plunker link http://plnkr.co/edit/XVCtNX29hFfXtvREYtVF?p=preview that I have prepared. In this example, I've asked you to: 1. Enter something in the input field. 2. Click directly on the button without interacting with any other element. ...

Issue with moving files after successful upload - encountering ENOENT Error

I am encountering a frustrating issue while trying to transfer files from the temp directory to the profile_pictures directory. This seemingly straightforward task has proven to be quite challenging as I have been stuck on it for an hour! The process shou ...

What location is most ideal for incorporating JavaScript/Ajax within a document?

Sorry for the seemingly simple question, but I would appreciate some clarification from the experts. When it comes to the three options of placing JavaScript - head, $(document).ready, or body, which would be the optimal location for ajax that heavily rel ...

Excessive CPU Usage in Meteor.js

An application built on meteor.js version 0.82 is currently being hosted on an Ubuntu 14.04 server equipped with 2GB of memory and 2 CPU cores. The deployment was done using the mup tool. Despite this setup, the CPU usage is unusually high, as indicated by ...

Enhance your webpage with our jQuery plugin that allows you to easily make Ajax

I am currently working on developing a custom jquery plugin. One of the functions within this plugin requires an ajax-call to be made. However, I want to ensure that the function remains chainable, meaning that the ajax-call should only happen after a re ...

Comet: showcase nested object on the client side using handlebars

Received JSON from helper : { "perms": [ { "userId": "rA5s5jSz7q9ZSCcNJ", "perms": [ { "moduleName": "Gallery", "container": { "ImageUpload": { ...