Update src/server/server.js
parent
764a89f907
commit
8d98e3d3ef
|
@ -20,7 +20,7 @@ app.use(express.static('public'));
|
||||||
|
|
||||||
// Setting of Port of Arduino
|
// Setting of Port of Arduino
|
||||||
const arduinoPort = new SerialPort({
|
const arduinoPort = new SerialPort({
|
||||||
path: 'COM3',
|
path: 'COM6',
|
||||||
baudRate: 9600
|
baudRate: 9600
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,15 +38,13 @@ function waitForData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetching data from Serialport: Getting Hand Information of the Player
|
// fetching data from Serialport: Getting Hand Information of the Player
|
||||||
function waitForData(playerid) {
|
|
||||||
return "coming soon!"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Request for Playerhand
|
// Get Request for Playerhand
|
||||||
app.get('/cardinmyhand/:playerid', async (req, res) => {
|
app.get('/cardinmyhand/:playerid', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const playerid = req.params.playerid;
|
const playerid = req.params.playerid;
|
||||||
const data = await waitForData(playerid); // Warte auf Daten von der seriellen Schnittstelle
|
const data = await waitForData(); // Warte auf Daten von der seriellen Schnittstelle
|
||||||
res.send(data); // Sende die Daten an den Client
|
res.send(data); // Sende die Daten an den Client
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).send('Fehler beim Lesen der Daten');
|
res.status(500).send('Fehler beim Lesen der Daten');
|
||||||
|
|
Loading…
Reference in New Issue