Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda