Top
Best
New

Posted by prophittcorey 7 hours ago

A Modern Web App in C(prophitt.me)
334 points | 145 commentspage 3
Surac 4 hours ago|
i also do that way, but i also have written my own webserver so i have no cgi interface. it serves files and provides "special" sites for the application written in. I use html and css as a frontend. nealy no js code in the html. Things i hate: - applicatin status handling - mixing html, css, js and c in one file - having no web "widgets" - having to make them by myself
lilbigdoot 5 hours ago||
I'm still in the middle of reading but I wanted to comment first that I had a pleasantly surprising experience a few years ago with CGI. I hadn't thought about CGI since I was a kid and I was tasked with adding a simple dynamic page to a server that had nothing running yet except apache. For whatever reason I though to try out CGI because of how simple the page was going to be, and yeah. Would recommend

I just got C FFI working in my LLVM based language last night so I'll need to take a look at playing around with BCHS :)

so-cal-schemer 18 minutes ago|
All my BCHS are hustlers.

Give it a shot; I bet you'd like it a lot.

hollowonepl 5 hours ago||
I was not thinking about vanilla C and CGI but I wrote my own modern web api server app in C++ (std+boost only) and I found it extremely pleasant experience. very reliable and little supply chain/dependency hell problematic too.

It’s for intranet business app so although it’s not yet production ready yet, definitively winning against many other modern approaches in web development in my consideration, and quite refreshing POC project.

whizzter 2 hours ago|
Yeah, shuddering at trying to manage memory vs static strings (with OOB risks) in plain C, modern C++ does give so much.

I'm actually also rewriting a header-only server (std c++ and sockets) I wrote a few years back to take advantage of C++26 reflections and similar to give it something similar in capability to AspNetCore+EFCore.

6c696e7578 1 hour ago||
fcgi tends to be overlooked
Quitschquat 5 hours ago||
I worked on a FORTRAN 77 CGI application in the early 00s. I think the host was Apache httpd, on some old HPUX version.
dhuan_ 4 hours ago||
How about modern web apps in shell scripts only:

https://dhuan.github.io/mock/latest/examples.html

chihuahua 1 hour ago|
Ideally, it should be a shell script for CMD.EXE, using the finest scripting language ever invented. The elegance of using FOR for such diverse tasks as enumerating files, file contents, string splitting, lists of numbers, and parsing the output of another command, is unmatched.
Scubabear68 6 hours ago||
From the article, "WRITING HTML AND CSS IN C ISN'T TOO BAD".

Um, any and all string handling in C is pretty miserable.

prophittcorey 6 hours ago||
To be fair, the HTML and CSS in C wasn't too bad.. the Youtube scraper was also written in C and that was a lot more painful :)
sam1r 5 hours ago||
I can empathize entirely. After writing a scraper for html in C, outputting html in C is a piece of cake.
feelamee 1 hour ago|||
tell me where working with strings is not miserable? Practically, modern languages with RAII make it easy at the cost of perfomance (doing a lot of allocations). So, if you doing lot of string handling, you still need to think how to do it in performant way. If doing it a bit - why care about miserable.
PhilipRoman 6 hours ago|||
Emitting strings is fine, it's the parsing that sucks.
Joker_vD 6 hours ago||
If you do it with the string functions from the standard library then yes, it is.
prophittcorey 6 hours ago||
The standard string functionality is painful. I wrote my own string view and string builder that work with fixed size strings. No memory allocations, etc.
throwaway2037 4 hours ago||
I am confused. Is this project open source? If yes, I could not find a link to the source code. Can someone help me?
emersonrsantos 5 hours ago||
Does anyone know if Hacker News uses CGI as well? I know there's some JavaScript and AJAX magic for the interactive elements on the frontend.
geoffbp 5 hours ago|
I remember the days of wrangling cgi-bin on Linux hosts! Not a common paradigm these days..
More comments...