Articles

Connecting Jest and Mongoose

The hard part about testing a backend application is setting up a test database. It can be complicated.

Today, I want to share how I setup Jest and Mongoose.

Endpoint testing with Jest and Supertest

I played around with testing lately. One thing I tried to do was to test the endpoints of my Express application.

Setting up the test was the hard part. People who write about tests don’t actually teach you how they set it up. I could not find any useful information about this, and I had to try and figure it out.

So today, I want to share the setup I created for myself. Hopefully, this can help you when you create your own tests.

How to setup a local MongoDB Connection

I always use MongoDB as a database when I work on an app. And I like to connect to a database on my computer because it speeds up dev and test-related work.

Today, I want to share how to create and connect to a local MongoDB Database.

Frontend vs Backend

I used to think it would be easy to write backend if I knew JavaScript. I thought it would be easy because Node is JavaScript. I didn’t have to learn a new language.

But I was wrong.

But backend was hard to learn. I took ages to learn it. (And I’m still trying to master it).

I realized I had problems learning backend because I thought Frontend and Backend were the same—they were just code.

That’s a big mistake.

Frontend and Backend are different beasts altogether. I had to respect their differences before I could learn Backend properly.

If I were to explain the difference between Frontend and Backend (in terms of implementation), I would say:

  • Frontend is about perception
  • Backend is about communication

How to build a calendar with CSS Grid

Building a calendar with CSS Grid is actually quite easy. I want to show you how to do it.

Here’s what you’ll create by the end of this article:

A calendar built with CSS Grid

Stages of learning

Over time, I realized there are five stages of learning.

  1. Awareness
  2. Panic
  3. Avoidance
  4. Acceptance
  5. Learning

Shutting down Fridays with Zell

If you stuck around for a while, you might have noticed I used to post a video (and an audio) every Friday for most of 2018. I call them “Fridays with Zell”.

In 2019, I decided to stop making videos. I want to share why I decided to stop making videos.

Everything You Need to Know About Date in JavaScript

Date is weird in JavaScript. It gets on our nerves so much that we reach for libraries (like Date-fns and Moment) the moment (ha!) we need to work with date and time.

But we don’t always need to use libraries. Date can actually be quite simple if you know what to watch out for. In this article, I’ll walk you through everything you need to know about the Date object.

Using Standard with VSCode

I use Visual Studio Code as my text editor. When I write JavaScript, I follow JavaScript Standard Style.

There’s an easy way to integrate Standard in VS Code—with the vscode-standardjs plugin. I made a video for this some time ago if you’re interested in setting it up.

But, if you follow the instructions in the video (or on vscode-standardjs’s readme file), you’ll come to notice there’s one small detail that needs to be ironed out.

Try writing a function the old way, and save it repeatedly. VS code will toggle between having and not having a space before the left-parenthesis of the function.

VS code toggles between having and not having a space before '('.

You get the same problem when you write methods with the ES6 method shorthands:

Same problem happens when you create methods with ES6 method shorthands.

Hold on while i sign you up…

🤗
Woohoo! You’re in!
Now, hold on while I redirect you.