mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-22 01:43:29 +01:00
Add simple listing of sonos devices and basic Dockefile for running it
This commit is contained in:
35
src/app.ts
35
src/app.ts
@@ -1,11 +1,26 @@
|
||||
import {createServer} from './utils/server'
|
||||
import express from "express";
|
||||
import * as Eta from "eta";
|
||||
|
||||
createServer()
|
||||
.then(server => {
|
||||
server.listen(3000, () => {
|
||||
console.info(`Listening on http://localhost:3000`)
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(`Error: ${err}`)
|
||||
})
|
||||
// import { Navidrome } from "./music_service";
|
||||
import makeSonos from "./sonos";
|
||||
|
||||
const PORT = 3000;
|
||||
|
||||
makeSonos().then((sonos) => {
|
||||
const app = express();
|
||||
app.use(express.static("./web/public"));
|
||||
|
||||
app.engine("eta", Eta.renderFile);
|
||||
app.set("view engine", "eta");
|
||||
app.set("views", "./web/views");
|
||||
|
||||
app.get("/", (_, res) => {
|
||||
res.render("index", {
|
||||
devices: sonos.devices(),
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.info(`Listening on ${PORT}`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user