Api middleware not working on api
I have my api created so im trying to use some middleware. I created a simple file to test, but its not showing when i call endpoint
autenticate.js
28 Replies
nuxt.config.ts
for example when i use this route its not showing nothing from middlewareUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes im looking inside terminal
any endpoint I call should show up, but it doesn't
my server/index its like that
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
worked?
for example, in some page im using
const { data: postData, error, pending } = await useFetch('/api/posts/paginate')
but its not showing nothing
let me try to restart serverUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh
worked
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i needed to restar server
yes hehe
on more question
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I want to apply this middleware only to some routes, is it possible or will it depend on validation? @The_Balm
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes, I want to have authenticated routes, I'm using the supabase so I want to validate the token and apply this authenticate to the closed routes. And currently it runs in all
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but this is not for the server?
in this case I want to prohibit access to the endpoint and not the route
would there be any way in the endpoint I could add some property to its context that claims to be auth: true for example and in the middleware I validate if it has this?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
for example, here, inside this post file i want to prevent this endpoint with that autenticate middleware
would there be any way to add some auth property to this event?
or something like that
i saw this
Will I be able to apply something to her context
auth: true
and validate in the middleware?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@The_Balm ty my friend
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i cant use middleware in routes, i could use middlewares inside api endpoints @BrianJM