-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a detection functionality for identifying available ports. - Created a new server instance listening on port 7001. - Added a test case to verify detection of the next available port. - **Bug Fixes** - Implemented error handling for server startup issues. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { detect } from '../../dist/esm/index.js'; | ||
|
||
detect(7001) | ||
.then(port => { | ||
console.log(port); | ||
}) | ||
.catch(err => { | ||
console.error(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { createServer } from 'node:http'; | ||
import { hostname } from 'node:os'; | ||
|
||
const server = createServer(); | ||
|
||
server.listen(7001, hostname(), () => { | ||
console.log('listening %s:7001, address: %o', hostname(), server.address()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters