Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfrazee/listen-random-port
Listen a node HTTP server on a random, unused port
https://github.com/pfrazee/listen-random-port
Last synced: 11 days ago
JSON representation
Listen a node HTTP server on a random, unused port
- Host: GitHub
- URL: https://github.com/pfrazee/listen-random-port
- Owner: pfrazee
- Created: 2016-06-30T23:52:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-01T00:03:39.000Z (over 8 years ago)
- Last Synced: 2024-12-12T22:49:07.505Z (17 days ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# listen-random-port
```js
var listen = require('listen-random-port')var server = http.createServer(serverFn)
listen(server, function (err, port) {
console.log('Listening', err, port)
// ...
})// full opts:
listen(server, { from: 5000, to: 6000, host: '127.0.0.1' }, function (err, port) {
console.log('Listening', err, port)
// ...
})
```