News for hackers. Stuff that matters.
Re:Show HN: I built a web framework in C by ashtonjamesd on Thursday October 09, 2025 @09:44AM (#45527617)
Hi, sorry maybe I should've added a comment for that.

The 'appRoute' is a macro that expands to a function signature.

The macro is: '#define appRoute(name) HttpResponse name(AppContext ctx)' and the parameter I passed as 'home' is expanded into the function name. The reason is because all controller function signatures are the same, so just writing 'appRoute' allows the developer to save time writing endpoints!

It is a tradeoff between readability and development speed. And one of the ideas behind the framework is succint and minimal code.

Re:Show HN: I built a web framework in C by gwbas1c on Thursday October 09, 2025 @10:41AM (#45528393)
So it creates a function called "home", and that is what you pass to get?

Makes sense, thanks!

Re:Show HN: I built a web framework in C by nodesocket on Thursday October 09, 2025 @01:36PM (#45530727)
Thanks for explaining. I was also a bit confused at a first where the home variable being passed into get() was coming from.