mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Listing devices and services on bonob page sourced from sonos devices
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import express, { Express } from "express";
|
||||
import * as Eta from "eta";
|
||||
import { Sonos } from "./sonos";
|
||||
import { Sonos, servicesFrom } from "./sonos";
|
||||
|
||||
function server(sonos: Sonos): Express {
|
||||
const app = express();
|
||||
@@ -11,9 +11,12 @@ function server(sonos: Sonos): Express {
|
||||
app.set("views", "./web/views");
|
||||
|
||||
app.get("/", (_, res) => {
|
||||
res.render("index", {
|
||||
devices: sonos.devices(),
|
||||
});
|
||||
sonos.devices().then(devices => {
|
||||
res.render("index", {
|
||||
devices,
|
||||
services: servicesFrom(devices),
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
return app;
|
||||
|
||||
Reference in New Issue
Block a user