29 lines
810 B
Markdown
29 lines
810 B
Markdown
|
# dynamic-webserver
|
||
|
|
||
|
Simple 69-line program written in Rust that dynamically sets up a website. Basically everything it does is configurable - which isn't much, it just looks at a directory and sets up website subdirs based on the folders in the directory.
|
||
|
|
||
|
```
|
||
|
/srv/website
|
||
|
root
|
||
|
about
|
||
|
blog
|
||
|
|
||
|
/srv/website/root
|
||
|
index.html
|
||
|
|
||
|
/srv/website/about
|
||
|
index.html
|
||
|
|
||
|
/srv/website/blog
|
||
|
index.html
|
||
|
script.js
|
||
|
```
|
||
|
|
||
|
With this setup of folders, and the below ENV variables, it'll set up a website with the following subdirs. `localhost:8080` (showing you `/srv/website/root/index.html`), `localhost:8080/about` (showing you `/srv/website/about/index.html`), and `localhost:8080/blog` (showing you, you guessed it, `/srv/website/blog/index.html`)
|
||
|
|
||
|
```env
|
||
|
DIRS_LOC=/srv/website
|
||
|
INDEX_PATH=/
|
||
|
ROOT_NAME=root
|
||
|
IP_ADDR=127.0.0.1:8080
|
||
|
```
|