HTTPE comes with a simple static file server.

Example

---
rules:
  - name: Before
    on:
      path: /dir/some-file.txt
    answer.content: Access denied
    respond:
      on_success:
        http_status: 403

  - name: Server Dir
    on:
      path: /dir
    serve.directory: /tmp/

On accessing http://localhost:3000/dir/ you get a list of files and folders inside the /tmp directory. The directory listing is rendered if no index.html file is found.

The rules are processed from top to bottom. If you specify a rule with a path that’s within the path of a directory, and if the rule is above the serve.directory rule, the rule has precedence. Note that path always refers to the URL, not to the filesystem.