Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davlgd/tVeb
Tiniest Veb Server, the efficient multiplatform open source solution to host your static stuff, written in V
https://github.com/davlgd/tVeb
server vlang web
Last synced: about 11 hours ago
JSON representation
Tiniest Veb Server, the efficient multiplatform open source solution to host your static stuff, written in V
- Host: GitHub
- URL: https://github.com/davlgd/tVeb
- Owner: davlgd
- Created: 2024-02-11T06:10:37.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-09-29T18:11:35.000Z (4 months ago)
- Last Synced: 2025-01-27T04:48:47.618Z (4 days ago)
- Topics: server, vlang, web
- Language: V
- Homepage:
- Size: 12.7 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- trackawesomelist - Tiniest Veb Server (⭐9) - A < 1MB static hosting web server written in V, based on `veb`. 🍃 (Recently Updated / [Oct 01, 2024](/content/2024/10/01/README.md))
- awesome-v - Tiniest Veb Server - A < 1MB static hosting web server written in V, based on `veb`. 🍃 (Applications / Web)
README
# Tiniest Veb Server
The efficient multiplatform open source solution to host your static stuff, written in [V](https://vlang.io), using the new [veb vlib](https://github.com/vlang/v/tree/master/vlib/veb). It fits in a single binary < 1 MB, without compression! It's a single binary, easy to compile, light and fast.
I use it to host [my tech blog](https://labs.davlgd.fr).
## Compile V from source
If you don't have V installed, you can compile it from source:
```bash
git clone https://github.com/vlang/v
cd v && make
./v symlink
```## Compile the server
Once you have V installed, clone this repository and build with the following command:
```bash
v -prod .
```Binaries for ARM64 Linux, macOS, x86_64 Linux, macOS, Windows are available. You can download them and SHA256/512 sums from the [releases page](https://github.com/davlgd/tVeb/releases).
## Run the server
Run the with the following command. It will serve files from the `public` folder by default:
```bash
./tVeb
```To check if everything is fine, open your browser and go to [`http://localhost:8080`](http://localhost:8080). If you use the content of this repository, you should see content of the `index.html` file from the `public` folder.
You can also use the `curl` command:
```bash
curl http://localhost:8080Hello, world!
```## Configuration
You can specify the folder where your files are located:
```bash
./tVeb /path/to/your/folder
```To change the port:
```bash
./tVeb 4242
./tVeb /path/to/your/folder 4242
```
## Custom headersYou can define some headers adding a `headers.toml` file where the server is running:
```toml
cache_control = "max-age=3600"
# Delay in seconds added to the date/time of the request to define `Expires` header
expiration_delay = 3600
```