{"id":19537386,"url":"https://github.com/languagexange/pong-node","last_synced_at":"2026-04-10T07:39:05.733Z","repository":{"id":222953485,"uuid":"758751544","full_name":"LanguageXange/pong-node","owner":"LanguageXange","description":"a pong game with socket.io and express ","archived":false,"fork":false,"pushed_at":"2024-02-20T17:55:49.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-16T01:34:10.094Z","etag":null,"topics":["express","node","pnpm","socket-io"],"latest_commit_sha":null,"homepage":"","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/LanguageXange.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":"2024-02-17T01:39:43.000Z","updated_at":"2024-02-17T01:45:21.000Z","dependencies_parsed_at":"2024-02-20T18:55:03.446Z","dependency_job_id":"1548221a-9724-4b77-b8b0-29ac3450ea04","html_url":"https://github.com/LanguageXange/pong-node","commit_stats":null,"previous_names":["languagexange/pong-node"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LanguageXange/pong-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanguageXange%2Fpong-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanguageXange%2Fpong-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanguageXange%2Fpong-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanguageXange%2Fpong-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LanguageXange","download_url":"https://codeload.github.com/LanguageXange/pong-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanguageXange%2Fpong-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274822112,"owners_count":25356439,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["express","node","pnpm","socket-io"],"created_at":"2024-11-11T02:27:38.640Z","updated_at":"2026-04-10T07:39:00.712Z","avatar_url":"https://github.com/LanguageXange.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pong Game with Socket.io \u0026 Express\n\nMultiplayer pong game with namespaces and rooms\n\n## Setting Up Socket.IO Server\n\n`pnpm init`\n\n`pnpm add socket.io`\n\nupdate index.html to include socket.io client script\n\nwe can remove computerAI related function in our `script.js`\n\n## Using Socket.io with Express\n\n`pnpm add express`\n\n```\n// api.js\nconst express = require(\"express\");\nconst app = express();\nconst path = require(\"path\");\napp.use(express.static(path.join(__dirname, \"public\")));\napp.use(\"/\", express.static(\"index.html\"));\n\n```\n\n### Change to ES Modules syntax\n\nhttps://socket.io/docs/v3/server-initialization/#es-modules\n\n### Notes\n\n- We will see the error:\n  `ReferenceError: __dirname is not defined in ES module scope` when we write this\n  `app.use(express.static(path.join(__dirname, \"public\")));`\n\n- Solution: https://github.com/nodejs/help/issues/2907#issuecomment-757446568\n\n```\nimport { fileURLToPath } from \"url\";\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n```\n\n## To play\n\n`pnpm start`\n\n## Helmet JS\n\n`pnpm add helmet`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanguagexange%2Fpong-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flanguagexange%2Fpong-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanguagexange%2Fpong-node/lists"}