Skip to content

Commit aaf2aab

Browse files
committed
imagine running routes on import instead of only when the user requests /start...
; Imagine you are ESM 💀
1 parent 174809d commit aaf2aab

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/wol.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ async function trySendWoLPackets(client, hosts, serviceUrl) {
226226
}
227227

228228
const wsProtocol = targetURL.protocol === "https:" ? "wss" : "ws"
229-
const wsURL = `${wsProtocol}://${targetURL.host}/ws?client_id=${responseData.client_id}`
230-
const ws = new WebSocket(wsURL)
229+
const wsUrl = `${wsProtocol}://${targetURL.host}/ws?client_id=${responseData.client_id}`
230+
const ws = new WebSocket(wsUrl)
231231

232232
await new Promise((resolve, reject) => {
233233
ws.once("open", resolve)
@@ -416,7 +416,7 @@ function errorClient(ws, err) {
416416
export function Router() {
417417
loadConfig()
418418

419+
router.get("/start", async (req, res) => await startProcessing(req, res))
420+
419421
return router
420422
}
421-
422-
router.get("/start", async (req, res) => await startProcessing(req, res))

0 commit comments

Comments
 (0)