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

274
Visualizações
What does "mount" mean in express?

I'm learning Express.js and I came across this definition:

"An Express router provides a subset of Express methods. To create an instance of one, we invoke the .Router() method on the top-level Express import. To use a router, we mount it at a certain path using app.use() and pass in the router as the second argument."

What does "mount" mean?

Thank you in advance!

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Mount simply means it prepends the path to your routes.

Say for example your routes have the following endpoints:

/list
/create
/update
/get/:id

And you mount it to /api/tasks. The endpoints will be:

/api/tasks/list
/api/tasks/create
/api/tasks/update
/api/tasks/get/:id

The way it's done in Express is:

const routes = require('./my/routes');

app.use('/api/tasks',routes);

Note: This terminology comes from how disks/drives work on Unix (Linux, MacOS etc.). Unlike Windows where disks are mounted to letters like C: or D: on Unix disks are mounted to folders. So for example if you connect a thumb drive named "Stuff" on Linux you will find a new folder called:

   /media/your_username/Stuff

And this folder will contain all the data of the thumbdrive. This is done by the automounter but you can also manually mount drives to empty folders. For example if I install the right software on my machine I can mount a remote shared drive to /Users/my_username/projects/shared_drives/shared_pictures.

So it's natural for programmers to call the act of adding things to paths mounting.

about 4 years ago · Santiago Gelvez 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