Skip to content

X-Lucifer/rust-xserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xserver

Static file server for hosting SPA dist directories, written in Rust.

Usage

# Serve current directory on default port 22345
xserver

# Serve dist directory on port 8080
xserver -p 8080 -d ./dist

# Bind to specific address
xserver --host 127.0.0.1 -p 3000

# Log level via RUST_LOG
RUST_LOG=debug xserver

Options

Flag Default Description
-p, --port 22345 HTTP server port
-d, --dir . Root directory to serve
--host all interfaces Bind address
-h, --help Show help
-V, --version Show version

Features

  • Auto-detect all network interfaces (IPv4 + IPv6)
  • Structured access logging via tracing
  • Request ID (X-Request-Id) and Server headers
  • Port range validation (1000-65535)
  • SPA fallback (index.html for client-side routing)

Build

# Debug build
cargo build
./target/debug/xserver.exe

# Release build
cargo build --release
Copy-Item target/release/xserver.exe build/

# Or one-liner
cargo build --release && Copy-Item target/release/xserver.exe build/

Requirements

  • Rust 1.85+
  • Windows 11+

Project structure

.
├── build.rs          # Windows resource embedding (icon, version info)
├── icon.png          # Application icon (auto-converted to .ico)
├── Cargo.toml        # Package manifest
├── src/
│   └── main.rs       # Server source
└── build/            # Release output directory

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages