https://github.com/szabgab/rustatic
Rust basic static web server for local development
https://github.com/szabgab/rustatic
rust rust-lang static-site web webserver
Last synced: 11 months ago
JSON representation
Rust basic static web server for local development
- Host: GitHub
- URL: https://github.com/szabgab/rustatic
- Owner: szabgab
- Created: 2023-07-12T05:57:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-09T16:10:23.000Z (about 2 years ago)
- Last Synced: 2024-08-10T23:18:48.659Z (almost 2 years ago)
- Topics: rust, rust-lang, static-site, web, webserver
- Language: Rust
- Homepage:
- Size: 44.9 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Rustatic - Rust Static server
When locally developing a static web site it can be quite useful to be able to run a small web server and be able to see the results.
Rustatic provides this service.
## Installation
### General public
* On the right-hand side of the [GitHub repository](https://github.com/szabgab/rustatic) you can find [Releases](https://github.com/szabgab/rustatic/releases).
* Download the latest one.
Then run
```
rustatic
```
or with more parameters run:
```
rustatic --indexfile index.html --nice --host 127.0.0.1 --port 5000 --path /path/to/html
```
Every command line parameter has a default value
* `--path` defaults to the current directory
* `--host` defaults to 127.0.0.1
* `--port` defaults to 5000
* `--indexfile` defaults to nothing. If provided then accessing a directory will yield the contenct of this file. Usually people have `--indexfile index.html`.
* `--nice` Server .html files with the extension. If the user accessed `/path/page` rustatic will return the `/path/page.html` file.
### Rust users
* If you have Rust installed you can install `rustatic` using the following command:
```
cargo install rustatic
```
* Then you can run
```
rustatic --help
rustatic --version
rustatic --path /path/to/html --host 127.0.0.1 --port 5000
```
### Developers
If you would like to help with the development of `rustatic` you can clone the repo and run the program without further installation:
```
git clone https://github.com/szabgab/rustatic
cd rustatic
```
It is recommended to set up the pre-commit hooks:
* Install [pre-commit](https://pre-commit.com/)
* In the `rustatic` folder run `pre-commit install`.
Then you can run the command like this:
```
cargo run -- --help
cargo run -- --version
cargo run -- --indexfile index.html --nice --host 127.0.0.1 --port 5000 --path /path/to/html
```
## Release and publish
* Update version number in Cargo.toml and in the comment below.
* `git add .`
* `git commit -m "update version to v0.2.7"`
* `git tag -a v0.2.7 -m "publish version v0.2.7"`
* `git push --tags`
* `cargo publish`
## TODO
* create executable that people can download so no need to clone from repo
* Handle TODO items in the code.