# VSCode Debug

### Flask application

#### Install debugpy in your Dockerfile

```docker
RUN pip install debugpy
```

#### Run the debug server

```bash
python3 -m debugpy --listen 0.0.0.0:5679 run.py
```

#### Expose debug port

```bash
docker run -p 1337:1337 -p 5679:5679 --rm --name=cop -it cop
```

#### launch.json (.vscode)

```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Attach to Container",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5679
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}/challenge",
                    "remoteRoot": "/app"
                }
            ]
        }
    ]
}
```

### NodeJS application

#### Run with debug server

```bash
node --inspect=0.0.0.0:9229 app.js
```

#### Expose debug port

```bash
docker run -p 1337:80 -p 9229:9229 -it --name=web_easterbunny web_easterbunny
```

#### launch.json (.vscode)

```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Node",
            "type": "node",
            "request": "attach",
            "port": 9229,
            "address": "localhost",
            "localRoot": "${workspaceFolder}/challenge",
            "remoteRoot": "/app",
            "protocol": "inspector"
        }
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qu35t.pw/vscode-debug.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
