Refactor MongoDB connection to use async/await#55
Conversation
gbowne1
left a comment
There was a problem hiding this comment.
I checked out this change locally for testing and review for merge
I started the server and it appears to work properly now with an async await
It also now works as expected per the issue and the PR descriptions.
Approving this PR for merge pending further review by collaborators and other maintainers.
Thanks for the opportunity to review your PR and for your contribution to this project.
Please feel free to work on this projects other issues and or any of the other issues in my other projects in my GitHub https://github.com/gbowne1/ especially since you do MERN https://github.com/gbowne1/reactsocialnetwork https://github.com/gbowne1/codebooker https://github.com/gbowne1/SavvyBudget https://github.com/gbowne1/fashion-marketplace/ and theres a few others
Thanks
|
I already reviewed and approved this PR. Am now waiting on other collaborators to review this PR for some measure of safety while we wait for unit tests and ci to be built for this I'll merge this after at least one or two other collaborators and maintainers approved this PR. Feel free to checkout rebase and review other PRs for approval Thanks |
gbowne1
left a comment
There was a problem hiding this comment.
This has already been reviewed by myself and accepted for merge now awaiting further review by other collaborators and maintainers and contributors to this project
Will merge this after it's been reviewed and accepted by a minimum of one or two others
This looks great.
Approving this PR for merge pending further review
|
One small suggestion (optional)
|
There was a problem hiding this comment.
Thanks for the PR
This PR resolves Issue #47 by switching the MongoDB connection to async/await.
The code is cleaner and easier to read, with no functional changes.
Overall, this PR looks good to me and is ready to merge 🚀
|
Well, now this has minor conflicts. Should be okay. Rebase then apply? Or.. |
|
@gbowne1 Noted! I'll resolve the conflicts and update the PR. Need some time to rebase and test. Will update soon. ✅ |
|
Several incoming merges so be sure your PR will merge after each |
|
@glenjaysondmello @Ved178 could you please review this. I'll merge. I am inclined to keep both changes for all of the server js merge conflicts it has now using the merge conflict resolve button her on GitHub. |
glenjaysondmello
left a comment
There was a problem hiding this comment.
✅ Reviewed and tested locally.
The async/await MongoDB connection works correctly and error handling behaves as expected. No functional regressions observed.
Looks good to merge. 👍
|
This has merge conflict's with server.js it might cause issues with #87 I want to merge 87 ahead of this then just accept both changes in the merge conflict UI on here (tad easier than doing the workaround) Thoughts? |
|
Merging this as is after successful approval of reviews post merge of #87 |
Title
Refactor MongoDB connection to use async/await
Description
This PR refactors the MongoDB connection in
server.jsto use async/await for cleaner asynchronous handling. The change improves error handling and aligns with recommended best practices.Changes Made
mongoose.connect(MONGODB_URI)to an async function with try/catch.then().catch()approachTesting
http://localhost:3000/api/streamsendpoint returns expected JSON dataScreenshots / Logs / Pastebin
/api/streamsendpoint response screenshot:Code Changes