implement bookmark delete
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user