Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function runServer() {
// Create a thing that represents a dimmable light
const light = new ExampleDimmableLight();
// Create a thing that represents a humidity sensor
const sensor = new FakeGpioHumiditySensor();
// If adding more than one thing, use MultipleThings() with a name.
// In the single thing case, the thing's name will be broadcast.
const server = new WebThingServer(new MultipleThings([light, sensor],
'LightAndTempDevice'),
8888);
process.on('SIGINT', () => {
server.stop().then(() => process.exit()).catch(() => process.exit());
});
server.start().catch(console.error);
}