{"id":19874165,"url":"https://github.com/pythoninthegrass/node_docker","last_synced_at":"2025-03-01T01:23:05.806Z","repository":{"id":85073774,"uuid":"483496635","full_name":"pythoninthegrass/node_docker","owner":"pythoninthegrass","description":"POC for Node.js debugging in Docker and/or WSL + Docker Desktop.","archived":false,"fork":false,"pushed_at":"2022-04-20T04:06:10.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T16:50:27.212Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythoninthegrass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-20T03:43:42.000Z","updated_at":"2022-10-04T02:52:05.000Z","dependencies_parsed_at":"2023-03-08T20:00:43.289Z","dependency_job_id":null,"html_url":"https://github.com/pythoninthegrass/node_docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fnode_docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fnode_docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fnode_docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fnode_docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythoninthegrass","download_url":"https://codeload.github.com/pythoninthegrass/node_docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241301794,"owners_count":19940707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T16:22:04.196Z","updated_at":"2025-03-01T01:23:05.783Z","avatar_url":"https://github.com/pythoninthegrass.png","language":"JavaScript","readme":"# node-docker\n\n**Table of Contents**\n* [node-docker](#node-docker)\n  * [Setup](#setup)\n  * [Usage](#usage)\n  * [Debug in VSCode](#debug-in-vscode)\n  * [Further reading](#further-reading)\n\n## Setup\n* Start the Node.js app in Docker\n    ```bash\n    # build the image\n    docker-compose build\n\n    # start the container in detached mode\n    docker-compose up -d\n\n    # tail the last 50 lines of logs\n    docker-compose logs -tf --tail=\"50\" node-docker\n    ```\n\n## Usage\n* Send a command\n    ```bash\n    curl --request POST --url http://localhost:8000/test --header 'content-type: application/json' --data '{\"msg\": \"testing\" }'\n    ```\n\n## Debug in VSCode\n* Select the Docker extension on the left-hand toolbar\n* Under containers, right click the `node_docker_node_docker` (awkward, I know) container\n  * Attach Visual Studio Code \u003e Hit enter to select the same container in the popup menu\n* A new VSCode window appears inside of the Docker container root directory\n  * Selct Open Folder in Explorer on the left-hand column\n  * Choose `/app` as the directory\n    ![](img/open_folder.png)\n* Select the `server.js` file in Explorer on the left-hand side\n* Run and Debug\n  * On the status bar at the bottom, select Run Current File\n    * Choose `Node.js...`\n    * Run Current File\n  * Set a breakpoint\n    ![Profit](img/server.js_docker_wsl.png)\n\n## Further reading\n[Build your Node image | Docker Documentation](https://docs.docker.com/language/nodejs/build-images/)\n\n[Build and run a Node.js app in a container](https://code.visualstudio.com/docs/containers/quickstart-node)\n\n[Debug Node.js Apps using Visual Studio Code](https://code.visualstudio.com/docs/nodejs/nodejs-debugging)\n\n[Docker Node.js Example](https://gist.github.com/remarkablemark/a877f2d78bfac0e9aca003c99df137ee)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythoninthegrass%2Fnode_docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythoninthegrass%2Fnode_docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythoninthegrass%2Fnode_docker/lists"}