Skip to content

wereHamster/devlisten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devlisten

Given a requestListener (a function you can pass to http.createServer), set up a TCP/IP server which listens on a free port, and a UNIX socket in the BOXEN_SOCKET_DIR. Once done, invokes the callback with strings describing all the addresses through which the application is reachable.

This function is useful during development, hence its name devlisten. It won't do anything stupid in production, but because it uses a non-deterministic IP port, it's probably not that useful there.

Since frameworks like express, connect, koa expose an interface which is compatible with requestListener, you can pass those directly to devlisten.

Example

const app = express();

devlisten('catalog', app, (err, addresses) => {
  console.log(`Listening on ${addresses.join(', ')}`);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published