My learning experience with ExpressJS and Mongoose
March 24, 2021Last year, I got an offer to join my friend in a company as backend developer. This position actually interesting yet challenging for me because they combine Laravel and JavaScript as the backend logic (ExpressJS and Mongoose). As I never develop production service using JavaScript, I challenge myself to accept the offer and commit to learn the framework.
Learning Process
Best learning method in programming is by doing. By building app or website or service that actually used by real user, so we can learn what the real challenge is. While I learn JS framework for building service that used by web app and mobile app, it demand fast learning and commitment to stay updated with the latest best practice code to prevent the server from loading too slow.
I learned ExpressJS and Mongoose from read the legacy code while trying to understand the logic, check the official documentation, and if I struggle to find what I need, go to Stack overflow of course. One thing I realized after using two different language in my career until now (PHP & JavaScript), is that the logics are fundamentally the same (loop, if else, try catch, etc) but indeed JS offer something like Promise() that make writing code is more fun.
Mongoose vs SQL
I know mongoose because of this, and itโs mind blowing to handle data. The simplicity of its query make it more fun to query the data. For example if you want to find data in the collection, you simply call :
1User.findOne({ email: "[email protected]" })
From that code you can save it to a variable or attach aย .then()ย like this:
1User.findOne({ email: "[email protected]" })
2.then((user) => {
3console.log(user)
4})
Thatโs basically it to find user with emailย [email protected]
. I think I love mongodb and mongoose.
Okay thatโs my experience learning new language and framework as a backend developer in a new company. Thanks for reading and how do you think of learning by doing in work? Let me know
๐๐ผShare this
๐More articles
Tools that I usually used as a Web Developer
For almost 2 years I have doing web developing as a job from designing landing page until write API for laravel-based web application in windows machine. Now I like to share my everyday tools for web developing that I usually used.
You can do these on Figma to work faster
Figma became popular these days to design a web/mobile user interface. Thatโs because Figma gives you more modern and reliable approach when come to performance, cloud storage, and collaboration. Now I wanna share with you how you can improve your designing process to work faster with Figma.
Kindle has changed my reading habits
Reading on a physical book and reading on a kindle give different experience. Those two things feel different when open the next page, highlights the text, holding it while reading, and so on. On this post, I wanna share with you what experiences that kindle will give to me compared to physical book.
Protect your form against spam bots
I was in the middle of embedding a third-party form on the website. The form snippet is just like the usual HTML form and the website is built using Next.js. At first, I thought itโs working well, fill the fields and submit it. But my team was told that we received various weird submissions with