abserve

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: ISC Imports: 14 Imported by: 0

README

abserve(1)

Minimal HTTP server that serves a virtual resource directly from memory.

% echo '<p>Hello, world!</p>' | abserve /index.html &
[1] 56382
% curl http://localhost:8080/index.html
<p>Hello, world!</p>

Overview

The resource is read either once and for all from standard input or, with the --poll option, repeatedly from a FIFO:

% mkfifo resource.fifo
% abserve --poll resource.fifo &
[1] 56385
% echo A > resource.fifo
% curl http://localhost:8080
A

Writing to the FIFO causes abserve to update the resource:

% echo B > resource.fifo      # update
% curl http://localhost:8080
B
% curl http://localhost:8080  # the resource is cached
B

It's also possible to serve concrete resources from a given directory. The virtual resource takes precedence over anything else.

% ls
cat.jpg   dog.jpg   index.html
% cat index.html                            # index.html on disk
<img src="dog.jpg">
% echo '<img src="cat.jpg">' | abserve --directory . /index.html &
[1] 56388
% curl http://localhost:8080/index.html     # virtual index.html
<img src="cat.jpg">
% curl http://localhost:8080/cat.jpg | catimg

cat.jpg


For details, see the man page.

Installation

go install github.com/giucal/abserve

Documentation

Overview

Abserve implements a minimal HTTP server that serves a “virtual” resource directly from memory.

% echo 'Hello, world!' | abserve -l :80 &
[1] 1234 1235
% curl localhost
Hello, world!

See the manual for a comprehensive description.

Notes

Bugs

  • Use of the flag package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL