Diving into Backend Development: My Journey with JavaScript, TypeScript, MongoDB, Node.js, and Express

Osarugue Enehizena
3 min readJun 27, 2024

--

Server side
Server-side

Hey everyone! I’ve been obsessed with learning server-side development stuff lately. I have been juggling JavaScript, and a language called TypeScript (wahala plenty for this language!), and this cool NoSQL database thing called MongoDB. I recently built a small Learning Management System (LMS) website to help people learn stuff, kind of like an online lesson with flashcards and quizzes. But then I ran into this weird bug with the logout function. I figured I’d share my struggle, and maybe save some other developer from the same headache.

The Problem: Logout Wahala

So, I got the user login working sweet after following this amazing tutorial by this YouTuber called “Becodemy” (seriously, check him out!) — I could see the user details stored in Upstash Redis, the session management tool. But logout? No way! Even after clicking that button, the user details remained in Redis, and the response from the server indicated that the logout had failed. Super frustrating because I followed the tutorial to the T! Spent way too many hours rewatching and combing through my code, but the solution wasn’t immediately clear.

The Solution: It was a Cookie Problem

Turns out, there was this tiny detail I missed in the tutorial — something about these “cookies” things. Apparently, I needed to add a couple of lines in my code to make sure these cookies worked properly. Basically, they help the server remember who’s logged in and who’s not. This step is vital because it allows the server to send and manage these tokens, which are crucial for maintaining user sessions.

Here are the lines of code that fixed the issue in the jwt.ts file:

res.cookie("access_token", accessToken, accessTokenOptions);
res.cookie("refresh_token", refreshToken, refreshTokenOptions);

Added those lines, and bam! Logout worked perfectly. Lesson learned: pay attention to the little things!

Leveling Up with HNG Internship

This whole backend development thing has me totally hooked. It’s like solving puzzles all day long, except the puzzles actually turn into cool websites and apps! That’s why I recently moved in with a friend so I can focus entirely on levelling up my software development skills.

Speaking of levelling up, the HNG internship is the perfect next level for a beginner backend developer like me. They say it’s tough, with plenty of work and those crazy deadlines everyone talks about. It’s going to push me to my limits, for sure. And that’s exactly what I need to grow! Plus, imagine working with other developers on real projects. Now that’s proper enjoyment.

I wasn’t playing when I applied for this internship though. I went all out and grabbed a spot in the HNG Premium program (check it out at https://hng.tech/premium if you’re curious). I figured the more I can learn and connect with other developers, the better.

Lessons Learned (The Hard Way!)

This LMS project was definitely not moi-moi and ice cream. But hey, that’s how you learn. Here are the biggest things I grabbed:

  1. Eagle Eyes: Sometimes, it’s the tiniest detail that throws sand in your garri. Like those darn cookies! Gotta pay attention to every step, even the seemingly boring ones.
  2. The Debugging Hustle: Let’s be honest, troubleshooting code can be a real calabash of trouble. But trust me, the feeling of finally fixing that bug is like winning the American lottery. Just need to be persistent and break things down one by one — like a coding detective!
  3. Session Security: Turns out, that keeping users logged in and out safely is a whole thing. Understanding these tokens and cookies is important for any app with logins. Don’t want people peeking at your stuff, right?

Coding Adventures Continue!

Learning backend development has been a rollercoaster — equal parts frustrating and totally rewarding. This LMS project, especially the logout drama, was a big reminder to focus on the details and never give up on a coding problem.

The best part? Every challenge I overcome makes me a better developer. Here’s to building even more awesome stuff and conquering the next coding hurdle!

For anyone just starting out in the server-side world, don’t let the bugs get you down. With every problem you solve, you’re one step closer to coding mastery. Keep pushing forward, and happy coding!

--

--

Osarugue Enehizena
Osarugue Enehizena

Written by Osarugue Enehizena

Software Engineering & Project Leading | Building Bridges Between Faith & Tech🌍🙏💻

No responses yet