{"id":15572850,"url":"https://github.com/distributedlife/everybody-needs-a-404","last_synced_at":"2026-05-02T14:32:20.851Z","repository":{"id":34173587,"uuid":"38021207","full_name":"distributedlife/everybody-needs-a-404","owner":"distributedlife","description":"A small proxy that lets you inject modifications to the response so you can test specific scenarios.","archived":false,"fork":false,"pushed_at":"2015-11-11T04:28:40.000Z","size":168,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T08:03:28.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/distributedlife.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}},"created_at":"2015-06-25T01:39:48.000Z","updated_at":"2015-08-26T02:16:57.000Z","dependencies_parsed_at":"2022-09-03T11:00:12.734Z","dependency_job_id":null,"html_url":"https://github.com/distributedlife/everybody-needs-a-404","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Feverybody-needs-a-404","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Feverybody-needs-a-404/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Feverybody-needs-a-404/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Feverybody-needs-a-404/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/distributedlife","download_url":"https://codeload.github.com/distributedlife/everybody-needs-a-404/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246149881,"owners_count":20731405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-02T18:07:15.507Z","updated_at":"2026-05-02T14:32:20.807Z","avatar_url":"https://github.com/distributedlife.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Everybody needs a 404\n\nA simple web proxy that lets you either return a status code for all requests or alter the response.\n\nI use when testing out specific scenarios on mobile applications. I point the mobile app at this proxy, the proxy forwards the request, the proxy modifies the response before responding itself.\n\n## How to return a status code.\n\n```text\nhttp://localhost:3000/setMode/404\n```\n\nNow all responses return 404.\n\n```text\nhttp://localhost:3000/setMode/200\n```\n\nBehaviour returns to normal\n\n## How to alter the response\n\n```javascript\nvar _  = require('lodash');\nfunction filterOutASpecificRecord (body) {\n  var json = JSON.parse(body);\n\n  json.records = _.reject(json.records, {id: 37});\n\n  return json;\n}\n\nvar proxy = require('everybody-needs-a-404');\nproxy.modify('/records', filterOutASpecificRecord);\nproxy.go('http://the-original-service.com:23423');\n```\n\nNow set the mode to altered and we are away.\n\n```text\nhttp://localhost:3000/setMode/altered\n```\n\n## How to rewrite a url\n\n```javascript\nvar _  = require('lodash');\nfunction newUrl (req) {\n  return \"/newPath\";\n}\n\nvar proxy = require('everybody-needs-a-404');\nproxy.rewriteUrl('/records/:id', newUrl);\nproxy.go('http://the-original-service.com:23423');\n```\n\nNow set the mode to altered and we are away.\n\n```text\nhttp://localhost:3000/setMode/altered\n```\n\n\n## How to rewrite a url AND change the respond\n\n```javascript\nvar _  = require('lodash');\nfunction newUrl (req) {\n  return \"/newPath\";\n}\n\nfunction filterOutASpecificRecord (body) {\n  var json = JSON.parse(body);\n\n  json.records = _.reject(json.records, {id: 37});\n\n  return json;\n}\n\nvar proxy = require('everybody-needs-a-404');\nproxy.rewriteUrl('/records/:id', newUrl, filterOutASpecificRecord);\nproxy.go('http://the-original-service.com:23423');\n```\n\nNow set the mode to altered and we are away.\n\n```text\nhttp://localhost:3000/setMode/altered\n```\n\n\n## How to slow down responses\n\n```text\nhttp://localhost:3000/setDelay/1000\n```\n\nNow all requests will pause for a second before responding\n\n```text\nhttp://localhost:3000/setDelay/0\n```\n\nBehaviour returns to normal.\n\n\n## What's with the name\n[Everybody Needs a 303](https://www.youtube.com/watch?v=o6eIBE7Bo3U). If the link doesn't work. Google it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributedlife%2Feverybody-needs-a-404","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistributedlife%2Feverybody-needs-a-404","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributedlife%2Feverybody-needs-a-404/lists"}