Conversation
Exposes all CLI options (dev, datastar, watch, store, topic, expose, tls, services) as an immutable const record so scripts can inspect how the server was started.
Root examples/serve.nu mounts individual examples under path prefixes. All sub-handlers use relative ./ paths so they work both standalone and mounted. Store-dependent examples (quotes) are conditionally mounted based on $HTTP_NU.store and greyed out in the index when unavailable. - basic: use relative paths, drain $in before generate for /time - datastar-sdk: @post('./increment') etc. - mermaid-editor: ./mermaid-diagram.js, @post('./') - quotes: .head -> .last, add threshold-gate filter, @get('./') - templates: seed store topics on startup, relative nav links
Move mount from inline defs into http-nu/router so it's reusable. Fixes path stripping (substring instead of str replace), adds $req.mount_prefix for sub-handlers that need absolute paths. www/serve.nu mounts examples hub at /examples/ with nav link.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
$env.HTTP_NUwas a mutable env var with just{dev: bool}. Scripts had no way to inspect how the server was started.$HTTP_NUis now an immutable const record exposing all CLI options:dev,datastar,watch,store,topic,expose,tls,services. Optional string fields arenullwhen not set.Examples hub
examples/serve.numounts individual examples under one server:The hub uses
$HTTP_NU.storeto conditionally mount store-dependent examples (quotes) and grey them out in the index when unavailable. Templates auto-seeds its store topics on startup.Other changes
./paths so they work both standalone and mounted.head->.last,threshold-gatefilter for clean SSE startup$HTTP_NU.store != null$inbeforegeneratefor/timestreaming