Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sholladay/default-port
Get the default port for a given protocol.
https://github.com/sholladay/default-port
constants http port protocol server
Last synced: 23 days ago
JSON representation
Get the default port for a given protocol.
- Host: GitHub
- URL: https://github.com/sholladay/default-port
- Owner: sholladay
- License: mpl-2.0
- Created: 2015-03-28T05:38:54.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-26T06:26:39.000Z (over 8 years ago)
- Last Synced: 2024-04-14T00:28:38.590Z (9 months ago)
- Topics: constants, http, port, protocol, server
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# default-port
> Get the default port for a protocol.
## Why?
- Translate user input to server config.
- Useful defaults for connecting to services.
- Determine if you can strip the port from a URL.## Install
```sh
npm install default-port --save
```## Usage
Get it into your program.
```js
const defaultPort = require('default-port');
```Retrieve the default port for a protocol, as a lowercase string.
```js
const port = defaultPort(
'https', // protocol you want to check
);
console.log(port); // => 443
```## Contributing
See our [contributing guidelines](https://github.com/sholladay/default-port/blob/master/CONTRIBUTING.md "The guidelines for participating in this project.") for more details.
1. [Fork it](https://github.com/sholladay/default-port/fork).
2. Make a feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. [Submit a pull request](https://github.com/sholladay/default-port/compare "Submit code to this project for review.").## License
[MPL-2.0](https://github.com/sholladay/default-port/blob/master/LICENSE "The license for default-port.") © [Seth Holladay](http://seth-holladay.com "Author of default-port.")
Go make something, dang it.