Auto Importing Issue

I'm trying to make a basic middleware and I'm facing an auto import issue. It doesn't recognize these functions and I cannot run my website. Thank you in advance!
No description
6 Replies
localhostess
localhostess7mo ago
Nuxt docs say to use https://nuxt.com/docs/guide/directory-structure/server#server-middleware
export default defineEventHandler((event) => {
console.log('New request: ' + getRequestURL(event));
});
export default defineEventHandler((event) => {
console.log('New request: ' + getRequestURL(event));
});
♡ Ryn / Sarc
♡ Ryn / SarcOP7mo ago
How do I implement my code with this, exactly?
♡ Ryn / Sarc
♡ Ryn / SarcOP7mo ago
No description
♡ Ryn / Sarc
♡ Ryn / SarcOP7mo ago
In the Nuxt docs for the middleware section, all the functions work I'm wondering what is the issue, is it with my IDE or my imports?
localhostess
localhostess7mo ago
Thre’s two types - client: middleware method that runs before a pages navigation - https://nuxt.com/docs/guide/directory-structure/middleware - server: middleware method that runs before a server route - https://nuxt.com/docs/guide/directory-structure/server#server-middleware your first screenshot is for the server route, since it shows in your server folder your second doc link is for the pages route. what are you trying to do?
♡ Ryn / Sarc
♡ Ryn / SarcOP7mo ago
Ohhhh, so that was the problem the whole time, yeah I was trying to do the client middleware, I didn't even realize i put it in the wrong folder and read the wrong docs, thank you!
Want results from more Discord servers?
Add your server