{"id":16612871,"url":"https://github.com/ttys3/static-server","last_synced_at":"2025-05-07T13:26:14.010Z","repository":{"id":40463081,"uuid":"398545507","full_name":"ttys3/static-server","owner":"ttys3","description":"simple static file server written in Rust based on axum framework","archived":false,"fork":false,"pushed_at":"2024-12-30T21:13:37.000Z","size":351,"stargazers_count":61,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-03T08:11:45.802Z","etag":null,"topics":["async","axum","file-server","rust","static-server","tokio","tower-http"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/ttys3.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}},"created_at":"2021-08-21T11:55:05.000Z","updated_at":"2024-12-30T22:26:17.000Z","dependencies_parsed_at":"2024-06-07T18:28:57.028Z","dependency_job_id":"65d65de6-7022-43c7-9f57-2ec58a430562","html_url":"https://github.com/ttys3/static-server","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fstatic-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fstatic-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fstatic-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fstatic-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttys3","download_url":"https://codeload.github.com/ttys3/static-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233347553,"owners_count":18662686,"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":["async","axum","file-server","rust","static-server","tokio","tower-http"],"created_at":"2024-10-12T01:45:11.314Z","updated_at":"2025-01-10T12:43:52.620Z","avatar_url":"https://github.com/ttys3.png","language":"Rust","readme":"# static-server\nsimple static file server written in Rust based on [axum](https://github.com/tokio-rs/axum) framework\n\n![screenshot](https://user-images.githubusercontent.com/41882455/144649440-d7e66a57-d6cb-4070-bb60-a0003e3d3d67.png)\n\nI'm learning Rust and axum.\n\nMy thought is simple.\n\naxum has a [static-file-server](https://github.com/tokio-rs/axum/tree/main/examples/static-file-server) example, which only serve static files under a directory and does not list the directory index.\n\nit also has a [templates](https://github.com/tokio-rs/axum/tree/main/examples/templates) example which uses askama as template engine to parse a Jinja2 like template.\n\nI thought I could simply combine the code of the two and my job is done -_-\n\nBut things didn't go in the way I thought\n\n\n## why created this ?\n\nlong time ago, I used to start a static http server like this (using the python3 built-in http server) :\n\n```shell\npython3 -m http.server -d .\n```\nsince I'm learning Rust, and I found an interesting web framework that is `Axum`, I want to use Axum to implement a simple static server mainly for studying purposes.\n\nthe python one support some command line flags:\n\n```shell\n❯ python3 -m http.server -h\nusage: server.py [-h] [--cgi] [--bind ADDRESS] [--directory DIRECTORY] [port]\n\npositional arguments:\n  port                  Specify alternate port [default: 8000]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --cgi                 Run as CGI Server\n  --bind ADDRESS, -b ADDRESS\n                        Specify alternate bind address [default: all interfaces]\n  --directory DIRECTORY, -d DIRECTORY\n                        Specify alternative directory [default:current directory]\n```\n\nso does this one:\n\n```shell\n❯ static-server -h\nstatic-server 0.4.2\nA simple static file server written in Rust based on axum framework.\n\nUSAGE:\n    static-server [OPTIONS]\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nOPTIONS:\n    -a, --addr \u003caddr\u003e        set the listen addr [default: 127.0.0.1]\n    -l, --log \u003clog-level\u003e    set the log level [default: debug]\n    -p, --port \u003cport\u003e        set the listen port [default: 3000]\n    -r, --root \u003croot-dir\u003e    set the root directory [default: .]\n```\n\n## TODO\n\nuse https://github.com/sampotts/plyr for audio,video\n\nhttps://github.com/tokio-rs/axum/blob/main/axum/CHANGELOG.md\n\n## Related Projects\n\nhttps://github.com/eliben/static-server\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttys3%2Fstatic-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttys3%2Fstatic-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttys3%2Fstatic-server/lists"}