Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger? #54

Open
venkatrjv opened this issue Oct 11, 2019 · 8 comments
Open

Debugger? #54

venkatrjv opened this issue Oct 11, 2019 · 8 comments
Assignees
Labels
question Further information is requested

Comments

@venkatrjv
Copy link

Hi,

How to add debugger / inspector for this boilerplate?

Thank in advance.

@issue-label-bot
Copy link

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

@furkanacaryes furkanacaryes added the question Further information is requested label Oct 11, 2019
@furkanacaryes furkanacaryes self-assigned this Oct 11, 2019
@furkanacaryes
Copy link
Contributor

furkanacaryes commented Oct 11, 2019

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!

@venkatrjv
Copy link
Author

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

@gjolund
Copy link
Contributor

gjolund commented Mar 31, 2020

@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>

@venkatrjv
Copy link
Author

@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

@gjolund
Copy link
Contributor

gjolund commented Mar 31, 2020

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

@venkatrjv
Copy link
Author

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..

@gjolund
Copy link
Contributor

gjolund commented Apr 1, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants