One that gets me is when I want to add sanity checks into a TS library function. In reality, the library may be called from straight JS, so I want to check some things to handle edge cases in a reasonable way, but often TS's type checking itself gets in the way.
Very cool, starred. I did add an "issue" suggesting that you publish a docker image to make this easier to run without worrying about direct dependencies.
Nioe writeup on these non-mutating methods. It is worth noting that if you have *VERY* large arrays in React you may want to combine with a viewport handler so only the visible nodes are rendered in order to improve DOM performance. It's one of the few places that I will lean towards earlier than later optimization as it can get noticeable fairly quickly.
I generally do line delimited JSON output for stdout logging in production environmnets. This lends itself very well to log shipping and ingestion into services like ELK-stack and Cloudwatch etc.
For JS based services, I will enrich the context object with logging/timing support that will add in a few bits from the request object (path, method, etc). It tends to work pretty well.
The shape of my log entries are usually along the lines of...
{
level: Enum(LogLevel)
timestamp: DateTime,
message: String
req: {
path: String,
search: String,
started: DateTime,
elapsed: Number/Decimal (ms) - since started
},
res?: {
status: Number,
statusText: String,
comment?: String,
},
error?: Error
details?: Object
}
The signature's for logging are like...
ctx.log.debug
(message: string, details?: any) => ...
(error: Error, details?: any) => ...
res bits from ctx if set/available and not part of the error or details (status/statusText/comment). Message will come from the error, when passing an error.
It's tended to work pretty well.. I fclone the error/details object(s) for safety... errors will graft back a few pieces that are hidden from enumerated properties (trace, etc)... Depends on the LOG_LEVEL though.
I'd say it (Hono) is about half a step above Oak or Koa in that it's a similar pattern with a "standard" entry that works pretty well cross-environment... Native for Deno and Cloudflare (I think Bun too) and a small shim for Node.js, the only hard-ish part is there's some inconsistency between publishing of different parts between npm and jspm, also some of the environment specific modules were a bit more difficult to work out (at least in deno) as a result.
I've toyed with CF Workers/Pages deployments with Turso and D1... I want to like the CF hosting stuff, but have a few times had issues where I'm actively developing and the test environment deployments bork.
I haven't used Next/Nest enough to fairly comment on them. I'm not really a fan of page based routing, not to mention for apps, I don't really care about SEO, so have been fine with SPA React.