Handmade Hero»Forums»Code
2 posts
What do you use to make a website?
I'm a huge fan of Casey and this series and I find myself nodding in agreement constantly to his rants. I now find the wide spread love-affair with OOP in programming circles really weird at this point. My question is what do you use or think is a good idea for doing web programming?

I'm thinking two layers here. In some regards I want something that's "good enough" where I can take some sort of HTML-ish template with variables and easily create pages and then some sort of script or whatever where programming logic can be applied to the page. And on the other hand I'd like to have some sort of long term goal in doing them in C since that's where I'm most comfortable, but that might not be too conducive to quickly getting a site up now.

I have some past experience with using PHP and twig, which maybe I should just use that because I can? Or maybe python or Go would be a better option (PHP was a mess from what I can recall).

Or is doing something in C maybe not as difficult as it may seem? I've looked at Onion some but it still seems like I'd have to put some up front investment in learning exactly how it works, and who knows if it's any good.

Anyway, at this point I'm just thinking out loud. I'm mostly just wondering the opinions of people who have a similar philosophy and isn't enamored with the Javascript framework flavor of the month (although if there's a good option out there then I'm not opposed). Thanks for your time!
Asaf Gartner
59 posts
Handmade Network Staff
What do you use to make a website?
You can configure Apache (or any other web server) to run your exe via CGI. Then you just have to write the response to stdout.
Not sure if that's what you're asking though.
Bill Strong
50 posts
What do you use to make a website?
If you are looking to program the front-end and the back end in C, take a look at Emscripten, which compiles c/c++ code to web safe JavaScript. You can write the back end in C/C++ as well, by either writing a simple web server for your app, or suing Nginx or Apache to forward your http messages.

Emscripten is being used as the test case for the new Web Assembly standard. Despite the name, this is currently just a compressed JavaScript file that has been serialized to a binary representation, not actual assembly language.

It is the best you can do for now, unless you can convince everyone to start using Genode OS, which lets you run any executables in the browser safely, due to their memory protection model. (Every application has the ability to grant memory to processes they spawn, and the browser simply doles out some memory from its own pool, but neither application can touch any other memory.
Mārtiņš Možeiko
2381 posts / 2 projects
What do you use to make a website?
If you are OK with supporting only Chrome, then there is option of using NaCl - https://developer.chrome.com/native-client
It's not really for replacing HTML/CSS, but game-like websites if you are OK rendering everything yourself with OpenGL ES then you can pretty much write all code in C/C++. It compiles to native code and runs in sandboxed environment.
2 posts
What do you use to make a website?
Huh! Some interesting options here. Thanks for the suggestions. I guess I'd better get to learning openGL because that sounds like an appealing route. I wonder when Casey will get to that point...sounds like not for a while. There are too many things I want to do and learn and not enough time to work on them!