You are viewing a single thread.
View all comments
3 points

Use TypeScript

permalink
report
reply
7 points

It’s a slight improvement, but you’re still inheriting the whole Js ecosystem, tooling, and most of the quirks of Js. There are far better languages you can use on the server, so I really don’t understand the appeal of using a Js based backend.

permalink
report
parent
reply
1 point
*

If rapid iteration is more important than performance or cost then you can more easily have a monolithic-ish build system that creates the client and the server from a single code base, or with shared code between them.

If you are trying to upgrade frontenders to be fullstack it’s an easier entry point.

Sometimes the performance characteristics of node actually is useful for serverless since a cold start and a hot start are not very different, closer to a fixed cost just to run a script when compared to something like dotnet which has slow cold starts but fast hot starts. Which is also why it sucks for most server code but on occasion this can be a useful characteristic.

If you want to do serverside rendering with client side hydration then it can be handy to implement the display logic once and run on both the client and the server (eg server side rendering react or vue etc)

Those are a handful of decent reasons but broadly speaking agree, it’s not the best choice if you care about cost and the benefits in the specific cases above are either rare or short lived.

Except really for SSRing with client hydrarion, that’s really the slam dunk case where it’s the more often than not correct choice due to the advantages of not duplicating logic.

The real reason why I often use server side JS is that it’s just faster to write in the first instance if I need to spin something up real quick or for infrequently invoked code where performance and cost don’t really matter. Of course for anything serious it’s a bad choice.

permalink
report
parent
reply
4 points

Js isn’t the only options for making full stack apps though. For example, I’ve built lots of apps using Clojure and ClojureScript getting the same benefits, but using a much better language. There are a few languages nowadays that compile to Js, but have much cleaner semantics. I kind of see Js the same way as assembly nowadays, to me it’s a compile target.

Another option nowadays is to use something like HTMX and just treat the frontend as a dumb client that simply renders the UI and collects input. This works fine unless the app has a lot of interactivity, which is majority of sites out there. HTMX also has the advantage of having the whole state in one place, and avoids the need for all the plumbing to ship data to the client via AJAX or GQL.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 4

    Monthly active users

  • 755

    Posts

  • 2.2K

    Comments