Tuesday, September 15, 2020
Colored text in VS Code Terminal
Most terminals allow to print colored text and the default Terminal in VS Code (based on PowerShell) is no exception.
- console.error("\033[91m" + ev.stack + "\033[0m");
asdf
- SyntaxError: Octal escape sequences are not allowed in strict mode.
asdf
- console.error("\x1B[91m" + ev.stack + "\x1B[0m");
asdf
Tuesday, April 28, 2020
VS Code and Node.js
Install Node.js from official web.
Nodemon
Install nodemon:
- npm install -g nodemon
launch.json
- {
"configurations": [
{
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"name": "nodemon",
"program": "${workspaceFolder}/qetrix.js",
"request": "launch",
"restart": true,
"runtimeExecutable": "nodemon",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
}
]
}
When I debugged the router and module init, I wanted to run it immediately after nodemon restarted, so simply I added a HTTP GET call right into server.listen
function:
- http.get("http://127.0.0.1:3000/subject");
In VS Code you don't even need to hunt for extensions, “Node Debug” is already built-in.
I have to admit, it's quite joyous to work like that. I really like the simplicity of PHP and this isn't actually that far off.
asdf