moleculerjs-boilerplate icon indicating copy to clipboard operation
moleculerjs-boilerplate copied to clipboard

Debugger?

Open venkatrjv opened this issue 4 years ago • 8 comments

Hi,

How to add debugger / inspector for this boilerplate?

Thank in advance.

venkatrjv avatar Oct 11 '19 07:10 venkatrjv

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

issue-label-bot[bot] avatar Oct 11 '19 07:10 issue-label-bot[bot]

Hi @venkatrjv!

You can use morgan to monitor traffic in command-line. And if you want to separate your debugging logs I can recommend debug.

You will need to add these in here.

Nonetheless, we have no implicitly dedicated tool for debugging.

👨‍💻 Happy Coding!

furkanacaryes avatar Oct 11 '19 08:10 furkanacaryes

Hi

Hi @venkatrjv!

You can use morgan to monitor traffic in command-line. And if you want to separate your debugging logs I can recommend debug.

You will need to add these in here.

Nonetheless, we have no implicitly dedicated tool for debugging.

👨‍💻 Happy Coding!

Is there any possible way to add node --inspect ?

As because moleculer js supports it.. Link -> https://moleculer.services/docs/0.13/faq.html#How-can-I-start-services-with-Moleculer-Runner-in-debug-mode

venkatrjv avatar Oct 11 '19 08:10 venkatrjv

@venkatrjv debugger works great in webstorm

Here is my current config

Launch Swagger with Debugger

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Swagger - TS Moleculer" type="NodeJSConfigurationType" application-parameters="--hot --repl --config moleculer.config.ts services/**/*.service.ts " node-parameters="--require ts-node/register -r tsconfig-paths/register" path-to-js-file="node_modules/moleculer/bin/moleculer-runner.js" working-dir="$PROJECT_DIR$">
    <EXTENSION ID="com.jetbrains.nodejs.run.NodeJSStartBrowserRunConfigurationExtension">
      <browser name="98ca6316-2f89-46d9-a9e5-fa9e2b0625b3" start="true" with-js-debugger="true" url="http://localhost:3001" />
    </EXTENSION>
    <method v="2" />
  </configuration>
</component>

Run Jest with Debugger

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Test Backend - TS Moleculer" type="NodeJSConfigurationType" application-parameters="--runInBand" path-to-js-file="node_modules/jest-cli/bin/jest.js" working-dir="$PROJECT_DIR$">
    <method v="2" />
  </configuration>
</component>

austinrivas avatar Mar 31 '20 09:03 austinrivas

@venkatrjv debugger works great in webstorm

Here is my current config

Launch Swagger with Debugger

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Swagger - TS Moleculer" type="NodeJSConfigurationType" application-parameters="--hot --repl --config moleculer.config.ts services/**/*.service.ts " node-parameters="--require ts-node/register -r tsconfig-paths/register" path-to-js-file="node_modules/moleculer/bin/moleculer-runner.js" working-dir="$PROJECT_DIR$">
    <EXTENSION ID="com.jetbrains.nodejs.run.NodeJSStartBrowserRunConfigurationExtension">
      <browser name="98ca6316-2f89-46d9-a9e5-fa9e2b0625b3" start="true" with-js-debugger="true" url="http://localhost:3001" />
    </EXTENSION>
    <method v="2" />
  </configuration>
</component>

Run Jest with Debugger

<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Test Backend - TS Moleculer" type="NodeJSConfigurationType" application-parameters="--runInBand" path-to-js-file="node_modules/jest-cli/bin/jest.js" working-dir="$PROJECT_DIR$">
    <method v="2" />
  </configuration>
</component>

Hey This is for pankod moleculer js to run the code. Looks like its not

venkatrjv avatar Mar 31 '20 10:03 venkatrjv

This is a webstorm debugger configuration to run the pankod moleculer boilerplate

austinrivas avatar Mar 31 '20 11:03 austinrivas

This is a webstorm debugger configuration to run the pankod moleculer boilerplate

Can u provide any reference so that I can add this to my code..

venkatrjv avatar Mar 31 '20 11:03 venkatrjv

Use webstorm and have .idea in your project root, whether you decide to add it to version control is up to you.

cd .idea
mkdir -p runConfigurations
cd runConfigurations
touch Test_Backend___TS_Moleculer.xml
touch Swagger___TS_Moleculer.xml

copy the run configurations into those files and you should be good to go.

You can also setup the run configurations through webstorms UI, using the configuration params in the xml element.

If webstorm run configurations are new to you I recommend watching a couple youtube videos to familiarize yourself with the basics.

Once you have them setup you can run them via the webstorm debugger.

For the swagger configuration you need to launch swagger via the webstorm npm launcher after starting the debugger so that it binds to the correct debug port that is dynamically assigned.

austinrivas avatar Apr 01 '20 07:04 austinrivas