I know this sounds weird, but some web frameworks, such as SvelteKit, actually support doing this. What is your take on this? Would you do this yourself? Personally, I find this feature to be really interesting, and I want to see how far I can push this feature.
It's been a holy grail for a long time to use the same language on the front end and the back end.<p>Netscape came out with a web server in the 1990s where you could write a <script> tag and do a document.write() on the front end or on the back end.<p>One obvious case is form validation: people like to do validation on the front end but they <i>need</i> to do validation on the back end. If you are using the same language on the front end and back end you can use the same validation code.<p>You will hear very different stories from different people. Everywhere I've worked since 2007 or so that had a working interactive web site has been using a Java or .NET based server. I think this is not just me being a Java programmer because one of these places hired me to do Python. It's very possible to use a Node.JS server, the folks I hang with think this is "not ready for prime time", other people will tell you they use Node.JS servers all the time.<p>Back when I was working on an ASP.NET system our front end was written in Silverlight which also uses .NET so you can share some of the C# code you write for the back end with the front end. Similarly there are frameworks like GWT which compile Java to Javascript, or tools like Clojurescript that would let you share code with a Clojure back end or let you compile Rust to WASM.<p>I think despite all that most people are still using a different front end and back end language.<p>Today there is a lot of interest in React-like frameworks that can do rendering either on the front end or the back end and that might be the most popular this idea has ever gotten.
I’d rather use languages designed for their domains<p>Kinda like how I prefer to use SQL over an ORM when working with a relational data store<p>With that said, most languages just <i>can</i> do backend work, thanks to a socket library, rather than being <i>designed</i> for the specific problems of web services. I guess that’s why we get frameworks<p>Idea: a backend-first language. The language mascot will be a rear end. The REPL prompt will be a majuscule B