Skip to content
/ tVeb Public

Tiniest Veb Server, the efficient multiplatform open source solution to host your static stuff, written in V

Notifications You must be signed in to change notification settings

davlgd/tVeb

Repository files navigation

Tiniest Veb Server

The efficient multiplatform open source solution to host your static stuff, written in V, using the new veb vlib. 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.

Compile V from source

If you don't have V installed, you can compile it from source:

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:

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.

Run the server

Run the with the following command. It will serve files from the public folder by default:

./tVeb

To check if everything is fine, open your browser and go to 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:

curl http://localhost:8080
<h1>Hello, world!</h1>

Configuration

You can specify the folder where your files are located:

./tVeb /path/to/your/folder

To change the port:

./tVeb 4242
./tVeb /path/to/your/folder 4242

Custom headers

You can define some headers adding a headers.toml file where the server is running:

cache_control = "max-age=3600"
# Delay in seconds added to the date/time of the request to define `Expires` header
expiration_delay = 3600

About

Tiniest Veb Server, the efficient multiplatform open source solution to host your static stuff, written in V

Topics

Resources

Stars

Watchers

Forks