Roadrunner

a webserver thats writable both ways :)

Installation

make build

Install to /usr/local/bin:

make install

Usage

./roadrunner --port 8080 --dir .

Flags:

  • --port, -p - Port to listen on (default: 8080)
  • --dir, -d - Directory containing .rdr files (default: current directory)

File Format

Files must end in .rdr and use this structure:

+++
path = /endpoint
writable = true
+++
body content

Front matter fields:

  • path - URL path (required)
  • writable - Allow POST requests (default: false)
  • password - Require authentication (optional)
  • password_on - Apply password to: none, read, write, both (default: none)

Body is everything after the second +++.

Behavior

GET requests read the file and return the body.

POST requests write the request body to the file if writable = true.

Files can be read/written by external programs. No locking is used. Changes are visible immediately.

Examples

Read-only:

+++
path = /users/1
writable = false
+++
{"id": 1, "name": "John Doe"}

Writable:

+++
path = /whiteboard
writable = true
+++
Initial message

Password protected:

+++
path = /secret
writable = true
password = mysecret123
password_on = both
+++
Protected content

Access protected endpoints:

curl -H "Authorization: mysecret123" http://localhost:8080/secret
curl -X POST -H "Authorization: mysecret123" http://localhost:8080/secret -d "data"

License

AGPL-3.0