Request/Response APIs in JavaScript web frameworks
2 points by begoon 2 days ago | 4 comments
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?
benoau a day ago | next |
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.
I dislike parameters within the URL now, when you consider the usability of Swagger and browser debug consoles a URL like `/api/update-thing?id=foo` is much nicer for non-developers, whereas `PATCH /api/thing/:id` is built on understanding REST conventions and generates ambiguous requests in browser tools.