We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e098115 commit 8ea4de1Copy full SHA for 8ea4de1
src/runtime/presets/node/database-handler.ts
@@ -1,7 +1,18 @@
1
import { eventHandler, getRouterParam } from 'h3'
2
+import { useStorage } from 'nitropack/runtime'
3
4
export default eventHandler(async (event) => {
5
const collection = getRouterParam(event, 'collection')!
6
7
+ const data = await useStorage().getItem(`build:content:database.compressed.mjs`) || ''
8
+ if (data) {
9
+ const lineStart = `export const ${collection} = "`
10
+ const content = String(data).split('\n').find(line => line.startsWith(lineStart))
11
+ if (content) {
12
+ return content
13
+ .substring(lineStart.length, content.length - 1)
14
+ }
15
16
+
17
return await import('#content/dump').then(m => m[collection])
18
})
0 commit comments