heyio 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/server.js +6 -3
- package/package.json +1 -1
package/dist/api/server.js
CHANGED
|
@@ -159,7 +159,8 @@ export async function startApiServer(config) {
|
|
|
159
159
|
});
|
|
160
160
|
app.get("/api/wiki/page/*path", async (req, res) => {
|
|
161
161
|
try {
|
|
162
|
-
const
|
|
162
|
+
const raw = req.params.path;
|
|
163
|
+
const pagePath = Array.isArray(raw) ? raw.join("/") : raw;
|
|
163
164
|
const content = await readPage(pagePath);
|
|
164
165
|
res.json({ path: pagePath, content });
|
|
165
166
|
}
|
|
@@ -168,14 +169,16 @@ export async function startApiServer(config) {
|
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
171
|
app.put("/api/wiki/page/*path", async (req, res) => {
|
|
171
|
-
const
|
|
172
|
+
const raw = req.params.path;
|
|
173
|
+
const pagePath = Array.isArray(raw) ? raw.join("/") : raw;
|
|
172
174
|
const { content } = req.body;
|
|
173
175
|
await writePage(pagePath, content);
|
|
174
176
|
res.json({ ok: true });
|
|
175
177
|
});
|
|
176
178
|
app.delete("/api/wiki/page/*path", async (req, res) => {
|
|
177
179
|
try {
|
|
178
|
-
const
|
|
180
|
+
const raw = req.params.path;
|
|
181
|
+
const pagePath = Array.isArray(raw) ? raw.join("/") : raw;
|
|
179
182
|
await deletePage(pagePath);
|
|
180
183
|
res.json({ ok: true });
|
|
181
184
|
}
|