diff --git a/docs/articles/debugging-server-code.md b/docs/articles/debugging-server-code.md new file mode 100644 index 00000000..32468b3e --- /dev/null +++ b/docs/articles/debugging-server-code.md @@ -0,0 +1,34 @@ +# Debugging server code + +alt:V allows you to debug your server-side code just like you would do in [NodeJS](https://nodejs.org/en/learn/getting-started/debugging). + +## How? + +1. Enable inspector in `resource.toml`. + +```toml +type = 'js' +main = 'main.js' + +[inspector] +# You can also specify host and port if needed +# (127.0.0.1:9229 by default) +# host = '127.0.0.1' +# port = '9999' +``` + +2. Add NodeJS interval with 0 delay. + +```js +setInterval(() => {}, 0) +``` + +3. Now you should be able to connect to inspector via Chrome DevTools for example: + + 1. Open any webpage in Chrome + 2. Press f12 to open console + 3. Click on NodeJS icon + +Video tutorial: + + diff --git a/docs/articles/toc.yml b/docs/articles/toc.yml index a3392c46..5befd658 100644 --- a/docs/articles/toc.yml +++ b/docs/articles/toc.yml @@ -48,4 +48,5 @@ href: vehicle/train-api.md - name: Workers href: workers.md - +- name: Debugging server code + href: debugging-server-code.md