13
238
Fork
You've already forked app
18

Spread request parameters into route render function parameter object? #298

Open
opened 2025年11月13日 13:55:36 +01:00 by aral · 0 comments
Owner
Copy link

In https://codeberg.org/kitten/app/src/branch/main/examples/slash-forwarding/page-with-parameters/index_%5Bname%5D.page.js, I was expecting the following to work when I authored it:

export default ({ name = ''} = {}) => kitten.html`Hello ${name}`

i.e., My expectation was that request.params would be spread into the parameter object received by the route render function.

Of course, that’s not how Kitten currently works (you get request object of type KittenRequest as a property and that, in turn, has a params property).

  • Should we spread request parameters into the parameter object of route render functions?
  • If so, what would the equivalent be for POST routes for consistency?
  • Side effects? (Overwriting default properties, etc.)

Decide if this is a good idea or not.

In https://codeberg.org/kitten/app/src/branch/main/examples/slash-forwarding/page-with-parameters/index_%5Bname%5D.page.js, I was expecting the following to work when I authored it: ```js export default ({ name = ''} = {}) => kitten.html`Hello ${name}` ``` i.e., My expectation was that `request.params` would be spread into the parameter object received by the route render function. Of course, that’s not how Kitten currently works (you get `request` object of type `KittenRequest` as a property and that, in turn, has a `params` property). - [ ] Should we spread request parameters into the parameter object of route render functions? - [ ] If so, what would the equivalent be for `POST` routes for consistency? - [ ] Side effects? (Overwriting default properties, etc.) Decide if this is a good idea or not.
Sign in to join this conversation.
No Branch/Tag specified
main
full-typescript
stateful-components-api-breaking-change
ip-address-support
improved-markdown-pages
markdown-consistency
proper-markdown-implementation-take-2
proper-markdown-implementation
fix-markdown-links
improved-component-model
middleware-refactor
implicit-event-handlers
event-scopes
regression-tests
access-stats
stats
connected-components
streaming-html-kitten-chat-examples
data-encapsulation
domain-migrations
better-slash-forwarding-in-urls
manual-app-updates
logs
kitten-scoped-database
only-inform-small-web-host-of-status-updates-if-being-deployed-by-it
only-ping-domain-on-first-deploy
markdown-pages
node-22
id-command
settings-refactor
show-uploads-in-settings
backup-and-restore
database-view-in-settings
prewarmed-servers
htmx-2
html-and-css-fragments
without-source-maps
only-use-kitten-process-manager-for-development-servers
parameter-objects
page-socket-routes
versioning-and-package-json-changes
evergreen-web
auto-updates
build-web-into-dist
two-databases-are-better-than-one
kitten-namespace
npm-ci
use-my-htmx-fork
errors-not-exits-wip
standardisation
strong-typing-and-tests
kitten-tag
page-tag
db-table-delete
npm-install-and-validation-issues-on-html
busboy-express
readline-under-cluster
development-libraries
slots-and-classes
named-slots
credits
dot-js
markdown-fix
safer-fields
validation
wrapping-the-renderer
xhtm
end-to-end-encrypted-chat-example
chokidar-to-watcher-migration
alpinejs
uri-cleanup
web-settings
cryptography
settings-app
development-mode
post
No results found.
Labels
Clear labels
documentation
Anything related to documentation
error messages
Issues related to Kitten’s error message handling
examples
Related to apps in the examples folder
housekeeping
Improves code quality by refactoring redundancy, removing old code, etc.
low priority
A non-essential nice-to-have
needs design
Not a simple fix but something that requires architectural work
parser
Issues regard Kitten HTML parser (inc. Markdown)
tests
Related to tests (unit, end-to-end, etc.) in some way
usability
Anything that affects usability
accessibility
Accessibility-related issues
API
Issues related to Kitten’s public interface (for authors)
bug
Something is not working
CLI
Command-line interface related issues (Kitten commands)
contribution welcome
Contributions are very welcome, get started here
crash
A bug that crashes the server
deployment
Related to the deployment of Kitten apps/sites
duplicate
This issue or pull request already exists
enhancement
New feature
feature branch
Relates to a feature being developed in a separate branch (not main)
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
installer
Issues related to the installation script
invalid
Something is wrong
is this still an issue?
Issues that need to be reproduced to confirm they haven’t already been fixed or made redundant
linux
Linux-specific issue
localisation
Localisation and internationalisation-related issues
macOS
macOS-specific issue
question
More information is needed
security
Security related issues
suggestion
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kitten/app#298
Reference in a new issue
kitten/app
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?