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