Wondering what’s next for npm?Check out our public roadmap! »

    default-port

    0.1.0 • Public • Published

    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

    npm install default-port --save

    Usage

    Get it into your program.

    const defaultPort = require('default-port');

    Retrieve the default port for a protocol, as a lowercase string.

    const port = defaultPort(
        'https',  // protocol you want to check
    );
    console.log(port);  // => 443

    Contributing

    See our contributing guidelines for more details.

    1. Fork it.
    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.

    License

    MPL-2.0 © Seth Holladay

    Go make something, dang it.

    Install

    npm i default-port

    DownloadsWeekly Downloads

    3

    Version

    0.1.0

    License

    MPL-2.0

    Last publish

    Collaborators

    • avatar