CodeSOD: Oh, Poop

This post was originally published on this site

The Daily WTF

Pearl was paying down some technical debt. She was trawling through their NodeJS application with a search for TODO and console.log. She was triaging the TODOs, and replacing the logs with a real logging framework.

The application was old, had many complicated routes for requests to be handled, and buried deep in a file was this code, which was clearly testing code that was never meant to end up in production:

var express = require(“express”); var router = express.Router(); /* GET home page. */ router.post(poopRoute, function (req, res, next) { const { poop, despacito } = req.body; console.log(poop); console.log(despacito); const ok = “ok”; return res.json({ ok, poop, despacito }); }); module.exports = router;

Poop indeed. It was obviously easy for Pearl to just remove this code, its potty humor, and it’s completely not dated pop-culture reference from 2017. But the funniest part of this code, for me, is that

To read the full article click on the 'post' link at the top.