I'm trying to run through a simple CRUD node module using VS Code.
A simplified version of the module looks like this:
const getAll = () => {
// return all elements
}
const saveElement = element => {
// takes an object and goes through it and saves it
}
const removeElement = id => {
// deletes the element with the passed id or returns false
}
const readElement = id => {
// returns the element from the data
}
I'm using yargs to get the arguments for the app, but also I'm using commands to call each method, like this
node app.js remove --id="123456789"
The launch.json in VS Code looks like this:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Test Remove",
"program": "${workspaceRoot}/app.js",
"args": [
"--id='123456789'"
]
}
]
}
What I've been unable to do is adding the specific remove, add, list, read commands into the debugger to check those methods, because without those the app runs just with the arguments and it returns a log I added indicating that the command passed is not recognized.
I looked in the VS Code docs, but I didn't found anything that relates to what I'm trying to do.