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

294
Visualizações
React JS - How to Create a Dynamic URL Instead of Id Which is in Mongoose Schema

How can I make the dynamic URL which is present in the Database as the link (tag) how can I use that link for fetching only one post from that database like an e-commerce website (it makes the new page for each post)

http://localhost:3000/{here is the link}

here is my code =>

Schema of Mongoose (link)

const mongoose = require('mongoose');

const Posts = mongoose.model('Posts', {
    link: {
        type: String,
        required: true,
        unique:true
    },
    
    title: {
        type: String,
        required: true
    }
    
    });

module.exports = { Posts }

"addPosts": {
    "link": "newoneawesomed",
    "title": "How can we achieve sucessfully",}

Below I making for id that renders a separate post from MongoDB

like

http://localhost:3000/625d056d4e412fb823d9cc4e

But how can achieve instead of id?

is

http://localhost:3000/newoneawesomed

which is present in the database...

Pls... help me to Solve these problems

about 4 years ago · Juan Pablo Isaza
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