TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Request/Response APIs in JavaScript web frameworks

2 pointsby begoon8 months ago
Out of curiosity, in web frameworks, what style of passing requests and responses to a handler you prefer: express-js style with non-standard req/res objects or hono/elysia style with standard web Request and Response objects? and why?

3 comments

benoau8 months ago
I like parameter objects a lot these days, they are more verbose to set up initially but they make function calls descriptive and the parameter order irrelevant, I think this is really good for developer usability.<p>I dislike parameters within the URL now, when you consider the usability of Swagger and browser debug consoles a URL like `&#x2F;api&#x2F;update-thing?id=foo` is much nicer for non-developers, whereas `PATCH &#x2F;api&#x2F;thing&#x2F;:id` is built on understanding REST conventions and generates ambiguous requests in browser tools.
throwaway485408 months ago
Express-style, because it&#x27;s very easy to work with my response asynchronously (before returning from my handler function) - e.g. respond with 200 immediately and then process the received data, or stream my response during processing.
shortrounddev28 months ago
I would vastly prefer controller endpoints to have actual objects and url params passed in rather than having to deal with a request or response object