Skip to content

v0.4.0

Choose a tag to compare

@cablehead cablehead released this 20 Feb 19:39
· 533 commits to main since this release

v0.4.0

Highlights

Serving Static Files

You can serve static files from a directory using the .static command. This
command takes two arguments: the root directory path and the request path.

When you call .static, it sets the response to serve the specified file, and
any subsequent output in the closure will be ignored. The content type is
automatically inferred based on the file extension (e.g., text/css for .css
files).

Here's an example:

$ http-nu :3001 '{|req| .static "/path/to/static/dir" $req.path}'

TLS Support

Enable TLS by providing a PEM file containing both certificate and private key:

$ http-nu :3001 --tls cert.pem '{|req| "Secure Hello"}'
$ curl -k https://localhost:3001
Secure Hello

Raw commits

  • feat: add some basic request logging (2025-02-20)
  • feat: add a .static built-in command to facilitate static file serving (#6)
    (2025-02-20)
  • fix: continue to serve if there's an error on accept (2025-02-13)
  • feat: add tls support (#5) (2025-02-13)
  • feat: log Nushell evaluation errors when processing a request (2025-02-13)
  • fix: capture the output from external commands (2025-02-06)
  • feat: move ResponseStartCommand to a thread_local pattern (2025-02-06)
  • feat: preserve the environment from executing the code snippet which returns
    the service closure ```nushell def do-foo [more: string] { "foo" + $more }
    (2025-02-05)
  • docs: README (2025-02-03)