{"id":20821996,"url":"https://github.com/internetarchive/httpd","last_synced_at":"2025-05-07T16:41:14.462Z","repository":{"id":152297353,"uuid":"619354543","full_name":"internetarchive/httpd","owner":"internetarchive","description":"Fast and easy-to-use web server, using the Deno native http server (hyper in rust). It serves static files \u0026 dirs, with arbitrary handling using an optional `handler` argument.","archived":false,"fork":false,"pushed_at":"2024-02-09T03:49:36.000Z","size":16,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":16,"default_branch":"main","last_synced_at":"2024-08-16T15:25:59.606Z","etag":null,"topics":["deno","fileserver","httpd","javascript","static-files","webserver"],"latest_commit_sha":null,"homepage":"https://deno.land/x/httpd/","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/internetarchive.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}},"created_at":"2023-03-27T01:05:25.000Z","updated_at":"2024-06-22T14:49:09.000Z","dependencies_parsed_at":"2023-12-12T10:50:18.687Z","dependency_job_id":null,"html_url":"https://github.com/internetarchive/httpd","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/internetarchive%2Fhttpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internetarchive%2Fhttpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internetarchive%2Fhttpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internetarchive%2Fhttpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/internetarchive","download_url":"https://codeload.github.com/internetarchive/httpd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225096649,"owners_count":17420293,"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":["deno","fileserver","httpd","javascript","static-files","webserver"],"created_at":"2024-11-17T22:13:40.785Z","updated_at":"2024-11-17T22:13:41.383Z","avatar_url":"https://github.com/internetarchive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# httpd\nA fast and easy-to-use web server, using the Deno native http server (hyper in rust).\nIt serves static files \u0026 dirs, with arbitrary handling using an optional `handler` argument.\n\n## Example\n```js\nimport httpd from 'https://deno.land/x/httpd/mod.js'\n\nhttpd((req, headers) =\u003e {\n  if (new URL(req.url).pathname.startsWith('/details/'))\n    return new Response('You are asking for some details', { headers })\n})\n```\nYou can pass a 2nd optional `opts` hashmap/object argument to `httpd()` to customize.\n\n## Defaults\n- HTTP port 5000 -- override with `opts` arg like: `{ port: 8888 }` or CLI arg like: `-p8888`\n- CORS headers   -- override with `opts` arg like: `{ cors: false }`\n- dir listings   -- override with `opts` arg like: `{ ls: false }`\n- dotfiles are omitted from dir listings\n\nIf that pathname doesn't map to a static file or dir (and get served directly), your\n`handler()` gets invoked.\n\nYou can return a `Response` object (Promise) or not return anything at all.\n- For the former case, we default the reply `content-type` to `text/html`.\n  - To override, use the optional 2nd argument `headers` to your handler, and change as desired, eg:\n    `headers.set('content-type', 'text/plain')`\n- For the latter case, we'll emit a 404 (lightly customized) page.\n\nIf your handler throws an exception, a general 500 page will be served.\n\nNOTE: This httpd daemon does NOT show dotfiles in dir listings (on by default) -- but it *does*\n      serve a dotfile if the caller knows the file/dirname.  Consider `.dockerignore` or similar\n      for your project to avoid dotfiles in your deployed webdir if needed.\n\n\n## More info\nMain methods used by `httpd`:\n- [Deno.serve()](https://deno.land/api?s=Deno.serve)\n- import { serveDir } from 'https://deno.land/std/http/file_server.ts'\n\nThe hyper server in rust:\n- https://deno.land/manual/runtime/http_server_apis\n- https://medium.com/deno-the-complete-reference/native-http-server-hyper-in-deno-1355c1171981\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finternetarchive%2Fhttpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finternetarchive%2Fhttpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finternetarchive%2Fhttpd/lists"}