19 lines
586 B
JavaScript
19 lines
586 B
JavaScript
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 });
|
|
},
|
|
|
|
async uploadCSV(req, res) {
|
|
const csvString = req.body;
|
|
console.log(csvString);
|
|
await global.db.uploadCSV(csvString)
|
|
res.json({ ok: true });
|
|
}
|
|
}
|
|
|
|
export default handlers; |