{"record":{"id":"c630b5ec20221916","repo":"NARKOZ/hacker-scripts","slug":"not-found","errorCode":null,"errorMessage":"Not Found","messagePattern":"Not Found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"info","filePath":"nodejs/fucking_coffee_yo_server.js","lineNumber":74,"sourceCode":"                        // Wait for 24s\n                        setTimeout(function() {\n\n                            // Pour Coffee!\n                            con.exec('sys pour', function(error, res) {\n                                con.end();\n                            });\n                        }, 24000);\n                    });\n                });\n            });\n\n            con.connect({host: coffee_machine_ip});\n        }\n    });\n\n    // Not Callback endpoint\n    coffeeApp.get('/*', function (req, res) {\n        res.sendStatus(404);\n    });\n\n    var coffeeServer = coffeeApp.listen(PORT, CALLBACK_URL, function() {\n        console.log('Coffee Server listening at %s:%s',\n            CALLBACK_URL, PORT);\n        console.log('\\nYo Callback URL: %s:%s/%s', \n            CALLBACK_URL, PORT, CALLBACK_ENDPOINT);\n    });\n});\n","sourceCodeStart":56,"sourceCodeEnd":84,"githubUrl":"https://github.com/NARKOZ/hacker-scripts/blob/b14a0a89bdf743c63ca4cc9cbcd866e050d7b3b0/nodejs/fucking_coffee_yo_server.js#L56-L84","documentation":"Express catch-all route handler coffeeApp.get('/*') responds with HTTP 404 (Not Found) for every GET path that is not CALLBACK_ENDPOINT. The server intentionally exposes exactly one meaningful route; it is registered after the callback route so Express matching order gives the callback precedence. There is no index or landing page, so the root path '/' also yields 404.","triggerScenarios":"A GET request to the server root '/' or to any path other than CALLBACK_ENDPOINT. Hit when an operator opens http://host:port/ in a browser without appending the callback path, or when CALLBACK_ENDPOINT was changed but clients (or the Yo provider) still request the old path.","commonSituations":"Browsing to the bare host:port to see if the server is up. CALLBACK_ENDPOINT renamed in code but the Yo provider's saved callback still points at the previous path. A web crawler or security scanner enumerating paths on the host.","solutions":["Request the exact CALLBACK_ENDPOINT path, e.g. http://host:port/<CALLBACK_ENDPOINT> (the startup log already prints this value).","If you want a human-readable landing page, add an explicit GET '/' handler before the catch-all.","Check for a trailing-slash or case mismatch between CALLBACK_ENDPOINT and the path the client requests.","Confirm the Yo provider's configured callback URL still matches the current CALLBACK_ENDPOINT value."],"exampleFix":"// before\ncoffeeApp.get('/*', function (req, res) {\n    res.sendStatus(404);\n});\n\n// after - informative root, keep catch-all last\ncoffeeApp.get('/', function (req, res) {\n    res.send('Coffee server up. Callback at ' + CALLBACK_ENDPOINT);\n});\ncoffeeApp.get('/*', function (req, res) {\n    res.sendStatus(404);\n});","handlingStrategy":"validation","validationCode":"// Client-side: confirm the path matches CALLBACK_ENDPOINT before requesting\nfunction buildCallbackUrl(base, endpoint) {\n  if (!endpoint || endpoint.charAt(0) !== '/') {\n    throw new Error('CALLBACK_ENDPOINT must start with /');\n  }\n  return base + endpoint;\n}\n// fetch(buildCallbackUrl(HOST, CALLBACK_ENDPOINT))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat the startup log line (it prints the full callback URL) as the source of truth for the path.","Add an explicit GET '/' handler if humans will browse the host.","After changing CALLBACK_ENDPOINT, update the Yo provider's saved callback URL in the same step."],"tags":["express","http-404","routing","nodejs"],"backgroundTag":null,"analyzedSha":"b14a0a89bdf743c63ca4cc9cbcd866e050d7b3b0","analyzedAt":"2026-08-13T01:34:52.027Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}