What mildly interesting day falls on your birthday? Click the 🎂 to find out!
There isn't really a purpose for this 😂 I was bored. I needed something to do. Went on Reddit (/r/unpopularopinion), rest is history.
- Click on the date
- Select your birthday or something
- Hit
Submit
- Magic?! ✨✨✨
- When you hit
Submit
, you make an HTTP POST request. Now, what does that POST request contain? It contains a string with the day, a single space and the month - That string is placed in a variable (date)
- The
.match(/\S+/g)
is used on thedate
variable to remove thatdisgustingwhitespace 😝. It also turns it into an array with the first item being the month and the second item the day. - Then those array items are put into corresponding variables (month and day, obviously 😂)
- The
.toLowerCase()
method is used on the month variable - The
.findOne()
function (provided by the Mongoose models) is executed to fetch a mongoose query object from our MongoDB database. That query object contains the day, the month and the name of the day (a.k.a. what mildly interesting thing is celebrated) - Then you're redirected to
/show/month/day
- Because you're redirected, you automatically make an HTTP GET request for the show page of that particular date
- Have a 🌮 'cause that's it!