2448fef53a
The URL signature becomes: https://workadventu.re/_/[instance]/[path_to_map.json] This allows us to create many instances of the same map (and therefore to create several different worlds for different people) An exit on a map can target another "instance" by passing the "exitInstance" property.
29 lines
794 B
TypeScript
29 lines
794 B
TypeScript
import express from "express";
|
|
import {Application, Request, Response} from "express";
|
|
import {OK} from "http-status-codes";
|
|
import {URL_ROOM_STARTED} from "../Enum/EnvironmentVariable";
|
|
|
|
export class MapController {
|
|
App: Application;
|
|
|
|
constructor(App: Application) {
|
|
this.App = App;
|
|
this.getMaps();
|
|
this.assetMaps();
|
|
}
|
|
|
|
assetMaps() {
|
|
this.App.use('/map/files', express.static('src/Assets/Maps'));
|
|
}
|
|
|
|
// Returns a map mapping map name to file name of the map
|
|
getMaps() {
|
|
this.App.get("/maps", (req: Request, res: Response) => {
|
|
return res.status(OK).send({
|
|
mapUrlStart: req.headers.host + "/map/files" + URL_ROOM_STARTED,
|
|
startInstance: "global"
|
|
});
|
|
});
|
|
}
|
|
}
|