Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikayla-maki/nuPHP
The nu Personal HomePage webserver and example website
https://github.com/mikayla-maki/nuPHP
Last synced: about 1 month ago
JSON representation
The nu Personal HomePage webserver and example website
- Host: GitHub
- URL: https://github.com/mikayla-maki/nuPHP
- Owner: mikayla-maki
- License: cc0-1.0
- Created: 2023-09-05T16:47:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-29T01:09:39.000Z (about 1 year ago)
- Last Synced: 2024-08-02T10:27:32.297Z (4 months ago)
- Language: Rust
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nu - nuPHP
README
nuPHP is a small Rust based web server for responding to HTTP requests with the Nushell language. You must have `nu` available in your path to run this webserver.
Use `nu site/db/init.nu` to create the database.
Use `cargo run` to start the webserver
See the `site` directory for the current example for how you could use this server to create a website.
Some notes on how it all fits together:
- The contents of the `site/public` directory will be available (via the web server) at `/`
- Non-Nushell files must have a file extension (not `.nu`) and will be served as static files.
- Nu files will be executed and the standard output will be sent as the response. Standard error will be printed to the console.
- Requests for paths without an extension will have `.nu` added automatically.
- All nu scripts are executed with `$env.GET`, `$env.POST` and `$env.HEADERS` available as variables.Some cool observations:
- You can test the nu page scripts by running them directly with the `$env.GET` and `$env.POST` variables set, no complex mocking required!
- Since nu is table based, you can mostly just use normal nu code to interface with the database.TODO:
- [x] Add cookies for identifying sessions
- [x] Optimize concurrency for session and session identifier
- [x] Implement session and header parsing via nuphp.nu script
- [x] Figure out a way to do file uploads
- [ ] Add a $COOKIE input/output variable
- [ ] file bug about highlighting for $env.REQUEST_PATH
- [ ] File highlight bug about # with nothing following it