feat: add GFF type schema definitions for visual editors
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import { lookupResref, getResrefCount } from "../nwscript/resref-index.js";
|
||||
import { lookupTlk, getTlkCount } from "../nwscript/tlk-index.js";
|
||||
import { get2DAFile, list2DAFiles, get2DARow } from "../nwscript/twoda-index.js";
|
||||
import { getSchema } from "../gff/schema.js";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -110,4 +111,15 @@ router.get("/2da/:name/:row", (req, res) => {
|
||||
res.json(data);
|
||||
});
|
||||
|
||||
router.get("/gff-schema/:type", async (req, res) => {
|
||||
try {
|
||||
const schema = await getSchema(req.params.type);
|
||||
if (!schema) return res.status(404).json({ error: "unknown GFF type" });
|
||||
res.json(schema);
|
||||
} catch (err: unknown) {
|
||||
const message = err instanceof Error ? err.message : "Unknown error";
|
||||
res.status(500).json({ error: message });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user