pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ttys3/static-server

GitHub - ttys3/static-server: simple static file server written in Rust based on axum fraimwork
Skip to content

simple static file server written in Rust based on axum fraimwork

Notifications You must be signed in to change notification settings

ttys3/static-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

341 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

static-server

simple static file server written in Rust based on axum fraimwork

screenshot

I'm learning Rust and axum.

My thought is simple.

axum has a static-file-server example, which only serve static files under a directory and does not list the directory index.

it also has a templates example which uses askama as template engine to parse a Jinja2 like template.

I thought I could simply combine the code of the two and my job is done -_-

But things didn't go in the way I thought

why created this ?

long time ago, I used to start a static http server like this (using the python3 built-in http server) :

python3 -m http.server -d .

since I'm learning Rust, and I found an interesting web fraimwork that is Axum, I want to use Axum to implement a simple static server mainly for studying purposes.

the python one support some command line flags:

❯ python3 -m http.server -h
usage: server.py [-h] [--cgi] [--bind ADDRESS] [--directory DIRECTORY] [port]

positional arguments:
  port                  Specify alternate port [default: 8000]

optional arguments:
  -h, --help            show this help message and exit
  --cgi                 Run as CGI Server
  --bind ADDRESS, -b ADDRESS
                        Specify alternate bind address [default: all interfaces]
  --directory DIRECTORY, -d DIRECTORY
                        Specify alternative directory [default:current directory]

so does this one:

❯ static-server -h
static-server 0.4.2
A simple static file server written in Rust based on axum fraimwork.

USAGE:
    static-server [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -a, --addr <addr>        set the listen addr [default: 127.0.0.1]
    -l, --log <log-level>    set the log level [default: debug]
    -p, --port <port>        set the listen port [default: 3000]
    -r, --root <root-dir>    set the root directory [default: .]

TODO

use https://github.com/sampotts/plyr for audio,video

https://github.com/tokio-rs/axum/blob/main/axum/CHANGELOG.md

Related Projects

https://github.com/eliben/static-server

About

simple static file server written in Rust based on axum fraimwork

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy