implement bookmark delete

This commit is contained in:
2025-05-07 15:47:08 +01:00
parent 30cc4d3fb5
commit e87a6586b6
26 changed files with 763 additions and 149 deletions

View File

@@ -1,13 +1,15 @@
import { authenticated, login, logout, signUp } from "./auth/auth.ts"
import { startBackgroundSessionCleanup } from "./auth/session.ts"
import { listUserBookmarks } from "./bookmark/handlers.ts"
import { insertDemoBookmarks } from "./bookmark/bookmark.ts"
import { listUserBookmarks, deleteUserBookmark } from "./bookmark/handlers.ts"
import { migrateDatabase } from "./database.ts"
import { httpHandler } from "./http-handler.ts"
import { httpHandler, preflightHandler } from "./http-handler.ts"
import { createDemoUser } from "./user/user.ts"
function main() {
async function main() {
migrateDatabase()
createDemoUser()
const user = await createDemoUser()
insertDemoBookmarks(user)
startBackgroundSessionCleanup()
Bun.serve({
@@ -24,7 +26,15 @@ function main() {
"/api/bookmarks": {
GET: authenticated(listUserBookmarks),
},
"/api/bookmark/:id": {
DELETE: authenticated(deleteUserBookmark),
OPTIONS: preflightHandler({
allowedMethods: ["GET", "POST", "DELETE", "OPTIONS"],
}),
},
},
port: 8080,
})
}