Custom Provider for FS unStorage with nitro #1543
Closed
melasculla
started this conversation in
General
Replies: 2 comments
-
|
i've upgrade to smth like this // /server/api/media/images/[...].get.ts
import { createIPX, createIPXH3Handler, unstorageToIPXStorage } from 'ipx'
export default defineEventHandler(async event => {
const storage = unstorageToIPXStorage(useStorage('media:images'))
const ipx = createIPX({ storage })
const ipxHandler = createIPXH3Handler(ipx)
return await ipxHandler(event)
})but i have error and this works fine idk what im doing wrong export default defineEventHandler(async event => {
const storage = unstorageToIPXStorage(useStorage('media:images'))
return await storage.getData('test.jpg')
}) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
i ended up with that image: {
domains: [
process.env.NUXT_PUBLIC_BASE_URL
],
alias: {
fs: `${process.env.NUXT_PUBLIC_BASE_URL}/api/media/images`
}
}<NuxtImg src="/fs/test.jpg" />works fine for me but i got errors from vue router for some reason nitro: {
routeRules: {
'/api/**': { ssr: false }
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there, idk how to implement this. i have fs driver in unstorage
i created nuxtImage driver similiar to ipx with my baseUrl
http://localhost:3000/api/mediathen i have my endpoint
how can i actually compress images with ipx and cache them?
my nuxt/image Provider
Beta Was this translation helpful? Give feedback.
All reactions