normalize-port-2
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

normalize-port-2

A handy function that normalizes a port into a number, string, or false.

install

npm install --save normalize-port-2

usage

const http = require("http");
const normalizePort = require("normalize-port-2");

const port = normalizePort(process.env.PORT || "8080");

const server = http.createServer(listenerOrApp).listen(port, () => {
    console.log(`Server running: http://127.0.0.1:${port}.`);
});
import http from "http";
import normalizePort from "normalize-port-2";

const port = normalizePort(process.env.PORT || "8080");

const server = http.createServer(listenerOrApp).listen(port, () => {
    console.log(`Server running: http://127.0.0.1:${port}.`);
});

credit

I just pulled this little function out of the normalize-port package.

Readme

Keywords

none

Package Sidebar

Install

npm i normalize-port-2

Weekly Downloads

2

Version

1.0.11

License

MIT

Unpacked Size

2.1 kB

Total Files

4

Last publish

Collaborators

  • sana_yasfp