2020-05-09 17:50:47 +02:00
|
|
|
import express from "express";
|
|
|
|
import path from "path";
|
|
|
|
import {Application, Request, Response} from "express";
|
|
|
|
import {OK} from "http-status-codes";
|
|
|
|
|
2020-05-09 19:41:21 +02:00
|
|
|
export class MapController {
|
|
|
|
App: Application;
|
2020-05-09 17:50:47 +02:00
|
|
|
|
2020-05-09 19:41:21 +02:00
|
|
|
constructor(App: Application) {
|
2020-05-09 17:50:47 +02:00
|
|
|
this.App = App;
|
2020-05-09 19:41:21 +02:00
|
|
|
this.getMpas();
|
2020-05-09 17:50:47 +02:00
|
|
|
this.assetMaps();
|
|
|
|
}
|
|
|
|
|
2020-05-09 19:41:21 +02:00
|
|
|
assetMaps() {
|
|
|
|
this.App.use('/map/files', express.static('src/Assets/Maps'));
|
2020-05-09 17:50:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//permit to login on application. Return token to connect on Websocket IO.
|
2020-05-09 19:41:21 +02:00
|
|
|
getMpas() {
|
|
|
|
this.App.get("/maps", (req: Request, res: Response) => {
|
|
|
|
return res.status(OK).send({
|
2020-05-09 21:28:50 +02:00
|
|
|
mapStart: {key: "floor0", url: "/map/files/Floor0"},
|
2020-05-09 19:41:21 +02:00
|
|
|
maps: [
|
2020-05-09 21:28:50 +02:00
|
|
|
{key: "floor0", url: "/map/files/Floor0"},
|
|
|
|
{key: "floor1", url: "/map/files/Floor1"},
|
2020-05-09 19:41:21 +02:00
|
|
|
]
|
|
|
|
});
|
2020-05-09 17:50:47 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|