workadventure/back/src/Controller/MapController.ts
gparant 5f11b065e1 Permit to dissociate data by room
- Update share room id.
 - Join room when a scene is loaded.
 - Add a room in constant variable.
2020-05-10 13:58:32 +02:00

29 lines
833 B
TypeScript

import express from "express";
import path from "path";
import {Application, Request, Response} from "express";
import {OK} from "http-status-codes";
import {ROOM_STARTED, ROOMS, URL_ROOM_STARTED} from "../Enum/EnvironmentVariable";
export class MapController {
App: Application;
constructor(App: Application) {
this.App = App;
this.getMpas();
this.assetMaps();
}
assetMaps() {
this.App.use('/map/files', express.static('src/Assets/Maps'));
}
//permit to login on application. Return token to connect on Websocket IO.
getMpas() {
this.App.get("/maps", (req: Request, res: Response) => {
return res.status(OK).send({
mapStart: {key: ROOM_STARTED, url: URL_ROOM_STARTED},
maps: ROOMS
});
});
}
}