weekly updates: learning JS on the backend[3/3/2022]

Toni T Diep
2 min readMar 4, 2022

--

Blog update with learning JS on the backend by building a markdown using Express.js, Node.js, and MongoDB by Web Dev Simplified. I am still going at it to a point of reviewing the tutorial from the very beginning to make sure I can debug this error. I rather do this to learn about the error. I am still unable to post a new article resulting in no ‘article id’. I am expected to have this long random string making ‘article id’. The error in the terminal alerted about deprecation and not having a solid async function underneath this line, “UnhandledPromiseRejectionWarning: MongooseServerSelectionError…”

Already tried attempts:
Google mongoose connection connect() function; depreciation on newUrlParser and useUnifiedTopology.
Checked the docs at this link
• Also checked between express versus bodyParser inside app.use() — still resulting in the same error.

server.js file snippet: //connecting our database
mongoose.connect('mongodb://localhost/blog')
// { useNewUrlParser: true, useUnifiedTopology: true })// mongoose.connect('mongodb://127.0.0.1/blog')
app.set('view engine', 'ejs')app.use(express.urlencoded({ extended: false }))
app.use(bodyParser.urlencoded({ extended: false }))
So then what is next? Can I still use this? The tutorial was published in 2020.

Options ideas to debug this:
• Restart the tutorial and go line by line — currently on.
• Check package.json file and run ‘npm install’ & ‘npm update’ before running the application on the browser.
• Examine server.js file and articles’ file routes
• I am certain that something is off with the articles’ route path as I am still unable to post new articles through to grab this ‘article id’.
• Next way of Googling (mini rabbit hole) about mongoose and the connect()
• Last option to finish through the tutorial in hopes that this markdown blog works at the end.
• Last next option — check comments on this tutorial and make a check myself.

Thanks for tuning in folks. I hope to find the answer to this error soon. As always, Happy Coding!

Resources
No More Deprecation Warning Options.” mongoosejs.com
Web Dev Simplified. “How To Build A Markdown Blog Using Node.js, Express, And MongoDB.” Youtube.com
• Web Dev Simplified. “JavaScript Async Await.” Youtube.com
• Web Dev Simplified. “JavaScript Promises in 10 Minutes.” Youtube.com

--

--

Toni T Diep
Toni T Diep

Written by Toni T Diep

multilingual Software Engineer, always learning and growing.

No responses yet