feat: add resref auto-lookup index for NWScript editor
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
writeFile,
|
||||
deleteFile,
|
||||
} from "../services/editor.service.js";
|
||||
import { lookupResref, getResrefCount } from "../nwscript/resref-index.js";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -48,4 +49,17 @@ router.delete("/file/:repo/*path", async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get("/resref/:resref", (req, res) => {
|
||||
const entry = lookupResref(req.params.resref);
|
||||
if (entry) {
|
||||
res.json(entry);
|
||||
} else {
|
||||
res.status(404).json({ error: "resref not found" });
|
||||
}
|
||||
});
|
||||
|
||||
router.get("/resref-count", (_req, res) => {
|
||||
res.json({ count: getResrefCount() });
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user