Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
Can I see the code of .js files under api folder of NextJS with browsers?

I was wondering if I can see the code of ".js files" under "api folder" of NextJS with browsers.

I read the post Next.js API is back-end? then, one of the answers says:

The back-end or server-side of Next.js is with the api folder.

So, according to the answer above, it seems like api folder is for backend which means it's hidden from users or clients so I cannot see the code of ".js files" under "api folder" of NextJS with browsers.

But the documentation of NextJS about API Routes doesn't explicitly say "api folder is for backend" so is api folder really and exactly for backend which is hidden from users or clients? so I cannot see the code of ".js files" under "api folder" of NextJS with browsers?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint instead of a page. They are server-side only bundles and won't increase your client-side bundle size.

source

Which means they are not public available files after build process

about 4 years ago · Juan Pablo Isaza Denunciar

0

Yes, the API routes are only for the backend. If you ever wrote an Express server, or perhaps some PHP, you know that the end user can only see the rendered HTML/data. When a user visits an API route, the server-side JavaScript, which in the API folder is NOT isomorphic but rather only executing on the server side will only render the rendered response to be rendered.

If you want to show any JS in the client-side you know what you have to do—
Talk to public/.

Note: NextJS doesn't explicitly say it can't be viewed in the client side, but I would expect it to be somewhat obvious.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda