Debugging server code
alt:V allows you to debug your server-side code just like you would do in NodeJS.
How?
- Enable inspector in
resource.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'
- Add NodeJS interval with 0 delay.
setInterval(() => {}, 0)
Now you should be able to connect to inspector via Chrome DevTools for example:
- Open any webpage in Chrome
- Press f12 to open console
- Click on NodeJS icon
Video tutorial: