Skip to content

answer beta ​

Function of @v12-engine/editor/vite

ts
export declare function answer(files: MapFiles, project: string | ProjectLayout, method: string, request: string, body?: string): Promise<FileAnswer>;

Answers what the editor asks, for a project at root (or laid out as ProjectLayout says). request is what comes after /__editor/: GET ping is { editor: true }, that there is a project here; the rest is of a game (game=td), but for GET project, what the project is (projectFacts); its maps (maps, map-facts, map, map-version, map-files), prefabs (prefabs, prefab), scenarios, tuning, data, looks, its own files (game-files), its code shown read only (code), new code from a template (scaffold) and where it defines something (source), each as its entry in the routes of this file says. What is asked of nothing there is 404; a method a thing has not, 405. The project's scripts (run) are not here: the plugin alone answers them, on a dev server (runScripts.ts)