{"id":13459050,"url":"https://github.com/sindresorhus/wait-for-localhost","last_synced_at":"2025-04-12T23:42:06.395Z","repository":{"id":53345792,"uuid":"134546459","full_name":"sindresorhus/wait-for-localhost","owner":"sindresorhus","description":"Wait for localhost to be ready","archived":false,"fork":false,"pushed_at":"2024-05-17T18:22:54.000Z","size":25,"stargazers_count":275,"open_issues_count":2,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-12T23:42:02.660Z","etag":null,"topics":["delay","localhost","nodejs","npm-package","server","wait"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sindresorhus.png","metadata":{"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"},"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-23T09:32:50.000Z","updated_at":"2024-12-19T11:52:42.000Z","dependencies_parsed_at":"2024-11-06T00:32:45.282Z","dependency_job_id":"c43676b2-7dcc-4587-aab4-9d62a464a534","html_url":"https://github.com/sindresorhus/wait-for-localhost","commit_stats":{"total_commits":30,"total_committers":8,"mean_commits":3.75,"dds":"0.30000000000000004","last_synced_commit":"acc101e1626df62a50cc928544859cd6649afe5b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwait-for-localhost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwait-for-localhost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwait-for-localhost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fwait-for-localhost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/wait-for-localhost/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647257,"owners_count":21139081,"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":["delay","localhost","nodejs","npm-package","server","wait"],"created_at":"2024-07-31T09:01:01.721Z","updated_at":"2025-04-12T23:42:06.371Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# wait-for-localhost\n\n\u003e Wait for localhost to be ready\n\nUseful if you need a local server to be ready to accept requests before doing other things.\n\n## Install\n\n```sh\nnpm install wait-for-localhost\n```\n\n## Usage\n\n```js\nimport waitForLocalhost from 'wait-for-localhost';\n\nawait waitForLocalhost({port: 8080});\nconsole.log('Server is ready');\n```\n\n## API\n\n### waitForLocalHost(options?)\n\nReturns a `Promise\u003cobject\u003e` that settles when localhost is ready.\n\nThe object contains a `ipVersion` property with a value of either `6` or `4` depending on the IP version that was used.\n\n#### options\n\nType: `object`\n\n##### port\n\nType: `number`\\\nDefault: `80`\n\n##### path\n\nType: `string`\\\nDefault: `'/'`\n\nUse a custom path.\n\nFor example, `/health` for a health-check endpoint.\n\n##### useGet\n\nType: `boolean`\\\nDefault: `false`\n\nUse the `GET` HTTP-method instead of `HEAD` to check if the server is running.\n\n##### statusCodes\n\nType: `number[]`\\\nDefault: `[200]`\n\nHTTP status codes to consider as successful responses.\n\n## Related\n\n- [wait-for-localhost-cli](https://github.com/sindresorhus/wait-for-localhost-cli) - CLI for this module\n- [delay](https://github.com/sindresorhus/delay) - Delay execution for a given amount of seconds\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fwait-for-localhost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fwait-for-localhost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fwait-for-localhost/lists"}