VS Code and Javascript Debugging
·128 words·1 min
I’ve been tinkering on a Discord-bot in Javascript using Node.js, together with my best friend.
For easier testing, we run the bot in Docker, so we don’t have all the dependencies littering our computers. We do want to be able to debug the bot, though, which is where I ran into an article on the internet by oneturkmen. The article has been deleted, but the GitHub-repository is (at the time of writing this article) still available here.
I’m running Windows 10 Professional, with Docker installed using the ‘Containers’-feature of Windows 10.
First, we have to have a docker-compose.yml
file, with the following data:
#docker-compose run --rm node /bin/bash
node:
image: node:carbon
working_dir: /usr/src/app
volumes:
- .:/usr/src/app
environment:
- DISCORD_TOKEN
ports:
- "9229:9229"
command: node -r dotenv/config --inspect=0.0.0.0 app.js