feat: implement delete note endpoint in server
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Application, Router } from "@oak/oak";
|
import { Application, Router } from "@oak/oak";
|
||||||
import { getNotes, getNotesByDid } from "./src/data/db.ts";
|
import { deleteNote, getNotes, getNotesByDid } from "./src/data/db.ts";
|
||||||
|
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
@@ -20,6 +20,12 @@ router.get("/:did/notes", (ctx) => {
|
|||||||
ctx.response.body = getNotesByDid(did, cursor, limit);
|
ctx.response.body = getNotesByDid(did, cursor, limit);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.delete("/:did/:rkey", (ctx) => {
|
||||||
|
const { did, rkey } = ctx.params;
|
||||||
|
deleteNote({ did, rkey });
|
||||||
|
ctx.response.status = 204;
|
||||||
|
})
|
||||||
|
|
||||||
const app = new Application();
|
const app = new Application();
|
||||||
|
|
||||||
app.use(async (ctx, next) => {
|
app.use(async (ctx, next) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user