Javascript

This commit is contained in:
metacryst
2025-11-08 07:03:30 -06:00
parent e17efce338
commit 6f9ed49b2e
23 changed files with 445 additions and 891 deletions

12
server/handlers.js Normal file
View File

@@ -0,0 +1,12 @@
import { broadcast } from './ws.js';
const handlers = {
updateLocation(req, res) {
const { name, latitude, longitude, timestamp } = req.body;
console.log(`Received location: (${name}, ${latitude}, ${longitude}) at ${timestamp}`);
broadcast("update-location", { name, latitude, longitude, timestamp });
res.json({ success: true });
}
}
export default handlers;