{"id":16446467,"url":"https://github.com/fbukevin/eb-nodejs-404","last_synced_at":"2026-02-15T03:32:03.793Z","repository":{"id":70827618,"uuid":"140241875","full_name":"fbukevin/eb-nodejs-404","owner":"fbukevin","description":"A demo of creating AWS Elastic Beanstalk Environment can response HTTP 404.","archived":false,"fork":false,"pushed_at":"2018-07-09T06:47:31.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T05:44:02.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fbukevin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-07-09T06:38:01.000Z","updated_at":"2018-07-09T06:47:32.000Z","dependencies_parsed_at":"2023-02-21T20:31:26.475Z","dependency_job_id":null,"html_url":"https://github.com/fbukevin/eb-nodejs-404","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fbukevin/eb-nodejs-404","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbukevin%2Feb-nodejs-404","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbukevin%2Feb-nodejs-404/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbukevin%2Feb-nodejs-404/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbukevin%2Feb-nodejs-404/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fbukevin","download_url":"https://codeload.github.com/fbukevin/eb-nodejs-404/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbukevin%2Feb-nodejs-404/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29466929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"online","status_checked_at":"2026-02-15T02:00:07.449Z","response_time":118,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T09:47:41.617Z","updated_at":"2026-02-15T03:32:03.788Z","avatar_url":"https://github.com/fbukevin.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThe original version of app.js is:\n```javascript\nvar port = process.env.PORT || 3000,\n    http = require('http'),\n    fs = require('fs'),\n    html = fs.readFileSync('index.html');\n\nvar log = function(entry) {\n    fs.appendFileSync('/tmp/sample-app.log', new Date().toISOString() + ' - ' + entry + '\\n');\n};\n\nvar server = http.createServer(function (req, res) {\n    if (req.method === 'POST') {\n        var body = '';\n\n        req.on('data', function(chunk) {\n            body += chunk;\n        });\n\n        req.on('end', function() {\n            if (req.url === '/') {\n                log('Received message: ' + body);\n            } else if (req.url = '/scheduled') {      // \u003c-------- Here might have a bug.\n                log('Received task ' + req.headers['x-aws-sqsd-taskname'] + ' scheduled at ' + req.headers['x-aws-sqsd-scheduled-at']);\n            }\n\n            res.writeHead(200, 'OK', {'Content-Type': 'text/plain'});\n            res.end();\n        });\n    } else {\n        res.writeHead(200);\n        res.write(html);\n        res.end();\n    }\n});\n\n// Listen on port 3000, IP defaults to 127.0.0.1\nserver.listen(port);\n\n// Put a friendly message on the terminal\nconsole.log('Server running at http://127.0.0.1:' + port + '/');\n```\n\nAll GET HTTP request will response HTTP 200 with default HTML content. To generate a test environment that can response 404 when request path not found, this updated the else part as following:\n```javascript\n...\n\t\t} else {\n\t\t\tif(req.url === '/'){\n\t\t\t\tres.writeHead(200);\n\t\t\t\tres.write(html);\n\t\t\t} else {\n\t\t\t\tres.writeHead(404);\n\t\t\t\tres.write('Not Found');\n\t\t\t}\n\t\t\tres.end();\n\t\t}\n...\n```\n\nYou can launch server and verify by using `curl -I http://localhost:3000/any`. The response should look like:\n\n```\n↪ curl http://localhost:3000/any\nNot Found\n\n↪ curl -I http://localhost:3000/any\nHTTP/1.1 404 Not Found\nDate: Mon, 09 Jul 2018 06:01:49 GMT\nConnection: keep-alive\n\n↪ curl -I http://localhost:3000\nHTTP/1.1 200 OK\nDate: Mon, 09 Jul 2018 06:03:28 GMT\nConnection: keep-alive\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbukevin%2Feb-nodejs-404","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffbukevin%2Feb-nodejs-404","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbukevin%2Feb-nodejs-404/lists"}