{"id":21969575,"url":"https://github.com/cinderblock/server-starter","last_synced_at":"2026-04-18T06:06:58.225Z","repository":{"id":57356733,"uuid":"71035956","full_name":"cinderblock/server-starter","owner":"cinderblock","description":"A simple tool for starting node servers on a port and optionally hostname or a unix socket","archived":false,"fork":false,"pushed_at":"2019-11-04T09:46:01.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T19:21:58.006Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cinderblock.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}},"created_at":"2016-10-16T07:18:46.000Z","updated_at":"2019-11-04T09:46:03.000Z","dependencies_parsed_at":"2022-09-26T16:31:58.721Z","dependency_job_id":null,"html_url":"https://github.com/cinderblock/server-starter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fserver-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fserver-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fserver-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinderblock%2Fserver-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cinderblock","download_url":"https://codeload.github.com/cinderblock/server-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245027752,"owners_count":20549379,"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-29T14:22:24.202Z","updated_at":"2026-04-18T06:06:58.179Z","avatar_url":"https://github.com/cinderblock.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# server-starter\n\nA simple tool for starting node servers on a port and optionally hostname or a unix socket.\n\nThis tool starts a server.\nIf a unix socket is specified, and the file already exists, it is detected, tested to see if it is alive, and removed if it is indeed dead.\nIt also allows setting a file mode and owner for the socket after creation.\n\n## Install\n\n```\nyarn add server-starter\n```\n\n```\nnpm install server-starter --save\n```\n\n## Usage\n\nserver-starter works on any \"server\" that has a \"`.listen(..)`\" method that takes a first argument that is a port number or socket file and an optional second argument, which is only valid if a port number was specified as the first argument, that is the network device to listen on.\n\n```\nconst ServerStarter = require('server-starter');\n\nconst server = new require('net').Server();\n\nconst socketOptions = {\n  listen: 'path/to/socket',\n  socketMode: 0770,\n  socketOwner: {\n    user: 1000,\n    group: 1000,\n  }\n}\nconst ipOptions = {\n  listen: 9001,\n  hostname: '127.0.0.1',\n}\n\nconst options = socketOptions || ipOptions;\n\nServerStarter(server, options, (err, info, extra) =\u003e {\n  if (err) {\n    console.log(err, info, extra);\n  } else {\n    console.log('Listening:', info);\n  }\n});\n```\n\nYou can use strings for `socketOwner` `user` or `group`.\n\n## Options\n\nThe `listen` option allows switching between IP socket or unix socket.\nEach has an optional extra settings.\n\n### IP Options\n - `listen` - *`Integer`* Port to listen on\n - `hostname` - *`String`*\n\n### Socket Options\n - `listen` - *`String`* Specify socket filename\n - `socketMode` - *`Integer`* passed to `fs.chmod` - octal notation is easiest\n - `socketOwner` passed to `fs.chown`\n   - `user` - *`Integer`* or *`String`*\n   - `group` - *`Integer`* or *`String`*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinderblock%2Fserver-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcinderblock%2Fserver-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinderblock%2Fserver-starter/lists"}