-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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: | ||
|
||
```bash | ||
$ 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: | ||
|
||
```bash | ||
$ 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) |