N
Nuxt3mo ago
8ear

Can't the server directory be used in SSG?

Hi, I am a company slave who was pushed into a corner just before the release of the product. We are using CMS and developing with nuxt3. I am developing with SSG, but the client does not want to display the path to the external API, so I have implemented a search implementation that usesFetch to get a list of the original data and then creates server/api/search.js in nuxt and calls this as the internal API to filter the data. The search is then performed by calling this internal API for filtering. Now, here is the problem... when I generate npx, an error occurs and server/api/search.js is no longer available. POST http://localhost:3000/api/search 404 (Not Found) Can't I use server/hogehoge in the SSG environment? If not, I would appreciate it if you could give me an alternative. (https://nuxt.com/docs/guide/directory-structure/server)
Nuxt
server/ · Nuxt Directory Structure
The server/ directory is used to register API and server handlers to your application.
1 Reply
manniL
manniL3mo ago
Alexander Lichter
YouTube
Nuxt Build or Nuxt Generate?
When creating a Nuxt application, it seems that there are two commands in your package.json to build your application for production: nuxt build and nuxt generate. Some of you might wonder why there are two commands, what the difference of both are and when to use which one? And that's exactly what you'll find out in less than 15 minutes - i...
Want results from more Discord servers?
Add your server