-Поиск по дневнику

Поиск сообщений в rss_thedaily_wtf

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 06.04.2008
Записей:
Комментариев:
Написано: 0


CodeSOD: Oh, Poop

Четверг, 08 Сентября 2022 г. 09:30 + в цитатник

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 the comment tells us that it's a GET request, when the code tells us it's a POST request. The mismatch is so sad. Alexa, play Despacito.

[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!

https://thedailywtf.com/articles/oh-poop

Метки:  

 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку