Last active
December 28, 2020 16:56
-
-
Save primaryobjects/fb357c3821fe70198b68e37b13a1fc12 to your computer and use it in GitHub Desktop.
VSCode node.js launch config for automatically starting the web browser. Visual Studio Code, VS Code, launch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", | |
"skipFiles": [ | |
"<node_internals>/**" | |
], | |
"program": "${workspaceFolder}/app.js", | |
"serverReadyAction": { | |
"pattern": "listening on port ([0-9]+)", | |
"uriFormat": "http://localhost:%s", | |
"action": "openExternally" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This config allows the web browser to automatically open to the localhost url at the correct port, when debugging an app with node.js and express. It works via the regular expression pattern that checks for
listening on port 3000
and then opening the web browser to the port number.