blob: e4d125274c0eee0b23f7d55e70a0059abd145bed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { Request, Response } from "express";
import { Server } from "socket.io";
import { setAllRobotsMoving } from "../simulation/robotMovementSimulator";
import { ErrorResponse } from "../types/error";
import { SimulationResponse } from "../types/robot";
async function moveAllRobots(req: Request, res: Response) {
const io: Server = req.app.get("io");
try {
const result: SimulationResponse = await setAllRobotsMoving(io);
return res.status(200).json(result);
} catch (error) {
console.error("Error on trying to set all robots moving:", error);
const errorResponse: ErrorResponse = {
message:
"Internal server error on trying to set all robots moving.",
error,
};
return res.status(500).json(errorResponse);
}
}
export default moveAllRobots;
|