{"id":21694114,"url":"https://github.com/fvilers/listen-once","last_synced_at":"2026-04-19T17:01:31.361Z","repository":{"id":180907406,"uuid":"665883644","full_name":"fvilers/listen-once","owner":"fvilers","description":"A Node.js web server that listen only once","archived":false,"fork":false,"pushed_at":"2023-07-13T09:17:51.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-26T13:49:11.105Z","etag":null,"topics":["server","typescript","typescript-library","web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fvilers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-13T08:05:09.000Z","updated_at":"2023-07-13T08:46:22.000Z","dependencies_parsed_at":"2023-07-13T09:50:00.578Z","dependency_job_id":null,"html_url":"https://github.com/fvilers/listen-once","commit_stats":null,"previous_names":["fvilers/listen-once"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvilers%2Flisten-once","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvilers%2Flisten-once/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvilers%2Flisten-once/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvilers%2Flisten-once/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fvilers","download_url":"https://codeload.github.com/fvilers/listen-once/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244628467,"owners_count":20483995,"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":["server","typescript","typescript-library","web"],"created_at":"2024-11-25T18:26:36.758Z","updated_at":"2026-04-19T17:01:31.256Z","avatar_url":"https://github.com/fvilers.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# listen-once\n\nA Node.js web server that listen only once\n\n## Purpose\n\nThis library expose a simple method that spins a web server that accept only one request. It can be used to retrieve a query string parameter or body from a authorization redirect (OAuth 2 for example).\n\n# ECMAScript module\n\nThis library is published as an ECMAScript module.\n\n## Usage\n\n```typescript\nimport http from \"node:http\";\nimport { listenOnce } from \"@fvilers/listen-once\";\n\nconst PORT = 3000;\nconst HOSTNAME = \"localhost\";\n\nfunction onListening() {\n  console.log(\"Server listening on\", `http://${HOSTNAME}:${PORT}`);\n}\n\nfunction onRequest(req: http.IncomingMessage, res: http.ServerResponse) {\n  console.log(\"Incoming request\", req.url);\n\n  // TODO: do something with the request\n\n  res.statusCode = 200;\n  res.end();\n}\n\nawait listenOnce(PORT, HOSTNAME, onListening, onRequest);\n\nconsole.log(\"Server closed\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvilers%2Flisten-once","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffvilers%2Flisten-once","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvilers%2Flisten-once/lists"}