I think for a simple website, especially one with spartenweb or zero JS principles, a language with an architecture like PHP or ASP/ASPX fits well, where you just write HTML and server side code in the same file, and you navigate to that file from your URL to load it. For example, wwwroot/path/to/page.php on the server corresponds to https://example.com/path/to/page.php

Problem is, both PHP and ASP are pretty terrible languages, and ASP(X) has the additional dealbreaker of not being open source and only running on Windows servers, so I don’t really want to use any of them (I’ve tried all three), so are there any better web languages or web frameworks that does something similar?

  • Mad
    link
    4
    edit-2
    2 years ago

    try rocket, the rust framework. it’s fast, simple and powerful. it doesn’t have the directory structure thing you want by default, but there’s nothing stopping you from using it like that. there’s not really any boilerplate so each file would just be a function that returns your html which is generated by server-side code (or is static). it also lets you handle dynamic routes and url queries VERY cleanly. you’d have to write your html in a string if you used the default stuff, but you can use typed_html, a small library that provides a macro (rust macros are not your usual evil macros) for writing html a bit more naturally. or you can use rocket’s built-in template engine support (i think it’s just tera and handlebars by default, i couldn’t see any others mentioned), though i haven’t used that so i can’t say how good it is.

    rocket is a great way to do nojs sites, because it’s built for APIs and not “modern” web pages, and it’s made so that you barely notice it even exists, so you can just write code/html like normal. the best thing is how it lets you respond to input, through very powerful dynamic URLs, through queries/forms, through static URLs, or through a combination of all of those

    (i love how the other guy wrote a one sentence recommendation while i wrote an essay. sry lol)