{"id":18631317,"url":"https://github.com/bahamas10/node-httpserver","last_synced_at":"2025-04-11T06:32:04.337Z","repository":{"id":7964279,"uuid":"9363066","full_name":"bahamas10/node-httpserver","owner":"bahamas10","description":"command line HTTP server tool for serving up local files, similar to python -mSimpleHTTPServer","archived":false,"fork":false,"pushed_at":"2017-03-12T18:39:10.000Z","size":17,"stargazers_count":24,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T10:37:47.977Z","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/bahamas10.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":"2013-04-11T05:42:54.000Z","updated_at":"2023-12-11T07:54:11.000Z","dependencies_parsed_at":"2022-08-28T08:41:34.173Z","dependency_job_id":null,"html_url":"https://github.com/bahamas10/node-httpserver","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahamas10%2Fnode-httpserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahamas10%2Fnode-httpserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahamas10%2Fnode-httpserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahamas10%2Fnode-httpserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahamas10","download_url":"https://codeload.github.com/bahamas10/node-httpserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248356305,"owners_count":21090184,"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-11-07T05:06:36.711Z","updated_at":"2025-04-11T06:32:04.092Z","avatar_url":"https://github.com/bahamas10.png","language":"JavaScript","readme":"httpserver\n==========\n\ncommand line HTTP server tool for serving up local files, similar to `python -mSimpleHTTPServer`\n\nInstallation\n------------\n\nFirst, install [Node.js][0].  Then:\n\n    npm install -g httpserver\n\nUsage\n-----\n\nrun `httpserver` on the command line to fire up a server on `0.0.0.0` port `8080`.\n\n    $ httpserver\n    {\n      \"lo0\": \"127.0.0.1\",\n      \"en1\": \"10.0.1.204\"\n    }\n    server started: http://0.0.0.0:8080\n\n\nSee the page at [http://localhost:8080][1].\n\n`htppserver` will serve out of your current working directory.\n\nYou can pass in arguments to change the port and host, as well as environmental variables\n\n    $ httpserver 80 localhost\n\nor\n\n    $ HTTPSERVER_PORT=80 HTTPSERVER_HOST=127.0.0.1 httpserver\n\nexample\n\n    $ httpserver\n    {\n      \"lo0\": \"127.0.0.1\",\n      \"en1\": \"10.0.1.204\"\n    }\n    server started: http://0.0.0.0:8080\n    127.0.0.1 - - [30/Oct/2013:18:24:38 -0400] \"GET / HTTP/1.1\" 200 - \"-\" \"curl/7.30.0\"\n    127.0.0.1 - - [30/Oct/2013:18:24:41 -0400] \"GET /test/ HTTP/1.1\" 404 - \"-\" \"curl/7.30.0\"\n\nEnvironmental Variables\n-----------------------\n\n- `HTTPSERVER_HOST` host to serve from, defaults to `0.0.0.0`\n- `HTTPSERVER_PORT` port to serve from, defaults to `8080`\n- `HTTPSERVER_NO_INDEX` disable reading of index.html/index.htm if found\n- `HTTPSERVER_NO_DIR_LISTING` return 403 for directory listings\n\nAdvanced Usage\n--------------\n\n    usage: httpserver [options] [port] [host]\n\n    command line HTTP server tool for serving up local files, similar to python -mSimpleHTTPServer\n\n    options\n      -d, --disable-index       disable reading of index.html/index.htm if found, env HTTPSERVER_NO_INDEX\n      -h, --help                print this message and exit\n      -H, --host \u003chost\u003e         the host address on which to listen, env HTTPSERVER_HOST defaults to '0.0.0.0'\n      -n, --no-indexes          return 403 for directory requests instead of a directory listing, env HTTPSERVER_NO_DIR_LISTING\n      -p, --port \u003cport\u003e         the port on which to listen, env HTTPSERVER_PORT, defaults to 8080\n      -u, --updates             check for available updates on npm\n      -v, --version             print the version number and exit\n\nWhy?\n----\n\nThere are a lot of packages in npm that do the same thing.  I wanted something that\nclosely mimicked Python's `python -m SimpleHTTPServer` with the following conditions.\n\n- Easy - You shouldn't have to provide arguments to get something easy up and running.  The IP addresses\non the machine are also printed for you\n- Configurable - Command line options and environmental variables can modify behavior at runtime\n- Safe - All other packages I found online were susceptible to directory traversal. This isn't\n- Simple - All code is in one file\n- Parsable - GET requests to directories are returned as directory listings, add `?json` for JSON\n- Proper HTTP - Proper Mime types (using the Mime module) and Caching headers are returned\n\nLicense\n-------\n\nMIT\n\n[0]: http://nodejs.org\n[1]: http://localhost:8080\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahamas10%2Fnode-httpserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahamas10%2Fnode-httpserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahamas10%2Fnode-httpserver/lists"}