Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const serve = (port, open, spa, https) => {
LocalWebServer.create({
port,
https,
compress: true,
directory: 'public',
spa: spa ? 'index.html' : undefined,
});
const ipList = Object.keys(os.networkInterfaces())
.map((key) => os.networkInterfaces()[key])
.reduce(reduceFlatten, [])
.filter((networkInterface) => networkInterface.family === 'IPv4')
.map((networkInterface) => networkInterface.address);
ipList.unshift(os.hostname());
const urls = ipList.map((address) => `http${https ? 's' : ''}://${address}:${port}`);