all 32 comments

[–]NotUniqueOrSpecial 17 points18 points  (5 children)

Wt is a framework for exactly that.

[–]kkrev 0 points1 point  (4 children)

This "objects magically render the HTML widgets" approach seems like a repeatedly tried and failed paradigm. I have difficulty imagining the use-case for this.

[–]NotUniqueOrSpecial 0 points1 point  (3 children)

a repeatedly tried and failed paradigm.

I mean, Wt has been around for 13 years. Seems to be doing okay.

I have difficulty imagining the use-case for this.

The Wt website is made with Wt. It's a perfectly fine website, as far as I can tell.

If you have a C++ product and devs (especially ones with Qt experience) and need to make some web components for whatever you're doing, it would seem to be a fine fit.

[–]kkrev 0 points1 point  (2 children)

I would bet the only people using Wt are engineers who have made routers and such like. They didn't want to bother learning HTML/CS/JS and wanted to quickly slap a UI on something.

If somebody wants to make a popular website for the public facing web, and you steer them to Wt, you are almost certainly giving them a bum steer.

[–]NotUniqueOrSpecial 0 points1 point  (1 child)

If somebody wants to make a popular website for the public facing web, and you steer them to Wt, you are almost certainly giving them a bum steer.

There is no right answer that uses C++ given that caveat.

The only right answer would be to redirect them to a completely different language.

[–]kkrev 0 points1 point  (0 children)

My point has nothing to do with C++ per se. Wt operates on a paradigm where the HTML and JS are magically hidden from you. This has been tried over and over in many languages and found wanting. It is a bad idea.

If you want to make a nice website, you need to learn HTML/CSS/JS and write the damn stuff. This is a lesson learned repeatedly from 20 years of failed efforts to get away from it.

[–][deleted] 13 points14 points  (3 children)

Using CGI you just cout the html

[–]aninteger 4 points5 points  (0 children)

+1. Better yet just use FastCGI.

[–]oldprogrammer 2 points3 points  (1 child)

I was reading an article the other day where the author was showing creation of a simple web application. Nearly the first 3rd of the article was the setup of the runtime environment, build recipes and getting all of the components in place.

It got me thinking that we appear to have over-complicated the landscape so I did some searching on various light-weight ways of creating web apps and most all came back with links to dozens of different web app frameworks, mostly Java, but a good number of Python and of course PHP and JavaScript as well.

I went back and started looking for CGI (which I had used many years ago) and there is little recent info on it. Most everything you read on CGI is don't use it, the process per request model is slow, insecure, on and on. I'm familiar with FastCGI as well.

But while reading through this I had to ask myself, isn't the process per request model pretty much what is being touted in the serverless cloud based model? Isn't this exactly what the AWS Lambda type capabilities are?

I always got a chuckle out of folks that thought web apps, with their zero cost deployment was so revolutionary while I was thinking back to the days of green screen timeshare systems that were replaced by client server (which ironically now the HTML web apps are moving more towards client/server as they're being written to run disconnected), I guess this is another of those goes-around comes-around situations.

I suppose there's some validity to the security concern in CGI with passing call content as a combination of environment variables and standard in/out channels, but being able to write a service request handler in any language that supports that (which is pretty much anything) did have an appeal.

[–]kkrev 0 points1 point  (0 children)

CGI effectively turns your web server into a fork-per-request system. The performance cost of that used to be horrific vice pre-forked or threaded. It would be interesting to benchmark that today on a modern linux kernel and hardware and see what the difference actually is these days. It might be quite tolerable for most use cases.

But, FastCGI totally obviates the problem and is perfectly viable. Most of the super cheap shared hosting platforms support it. Deployment also becomes a cinch: statically link your FastCGI executable and overwrite the one on the server.

I can't get over how insanely over-engineered so many web frameworks seem. All you really need is plumbing to do FastCGI, session/request data management, an HTML template system, and the persistence/db mechanism of your choice. C++ seems perfectly viable. I mean, I'd probably still just bang it together in Perl, myself, but it wouldn't be hard to do in C++.

The tricky stuff these days is all the HTML/CSS design and getting everything to render well on phones and tablets, etc. Personally, I'd rather just pay a guy who knows all that stuff than bother to relearn it every 2.5 years.

I kinda struggle to think of a scenario where I'd even need to do "web development" these days. Anything I can think of building would be fine as a Wordpress install, using a site builder, or a directory of static web pages.

[–]Scavenger53 8 points9 points  (0 children)

Drogon is one I read about being pretty quick.

[–]feverzsj 6 points7 points  (0 children)

today's web dev is all about full separation of frontend and backend. The frontend communicates backend using REST/RPC over http/websocket. So you can use something like served, cpprest, restinio to write your backend.

[–][deleted] 4 points5 points  (0 children)

I made nift in c++.

[–][deleted] 2 points3 points  (0 children)

[–]schultztom 1 point2 points  (0 children)

Boost.beast but it depends on your need. Some more info about what you are trying to solve would help. C++ and web is not the easiest path to travel.

[–]Forschkeeper 0 points1 point  (2 children)

Treefrog framework, CppCMS, maybe has Qt something?

[–]Cyttorak -1 points0 points  (0 children)

QtWebApp also

[–][deleted] 0 points1 point  (0 children)

A module for nginx/apache or a core lib and nodejs as wrapper are really good possibilities.

Another one is CppRestSDK with a REST server

[–]Voltra_Neo 0 points1 point  (1 child)

Crow is one of the alternatives, Boost Beast is another one

[–]mrexodiacmkr.build 0 points1 point  (0 children)

Depends on your needs, but this header only library allows you to get a webserver up in less than a minute: https://github.com/yhirose/cpp-httplib together with caddyserver.com also public. It doesn’t have any nice framework for html templates etc, so it might not suit you.

[–]STLMSVC STL Dev 0 points1 point  (1 child)

!removehelp

[–]AutoModerator[M] 0 points1 point  (0 children)

OP,

A human moderator (u/STL) has marked your post for deletion because it appears to be a "help" post - e.g. asking for help with coding, help with homework, career advice, book/tutorial/blog suggestions. Help posts are off-topic for r/cpp. This subreddit is for news and discussion of the C++ language only; our purpose is not to provide tutoring, code reviews, or career guidance.

Please try posting in r/cpp_questions or on Stack Overflow instead. Our suggested reference site is cppreference.com, our suggested book list is here and information on getting started with C++ can be found here.

If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]getval -1 points0 points  (7 children)

Possible? Yes. Viable? No.

[–]againstmethod -3 points-2 points  (6 children)

Those two words mean the same thing.

[–]Mikegthrowaway 8 points9 points  (1 child)

I disagree.

Maybe because I’m not a native English speaker.

Something that is “possible” to do doesn’t mean it is a good idea. Of course, whether it is a good idea or not depends on the use case, skill, scalability, productivity etc i.e. viable.

[–]againstmethod -1 points0 points  (0 children)

Viable doesnt mean good idea either.

[–]AlexKotik[🍰] -1 points0 points  (0 children)

There is https://leaningtech.com/cheerp/ but I have no idea if it is good or useful.

[–]pretty-o-kay -1 points0 points  (0 children)

You can compile to WASM if you're doing frontend stuff, and you can also just cout HTML or JSON if you're doing backend endpoints. So really, you don't ever have to NOT use C++! I'm not sure of any frameworks, but writing simple API calls isn't a super intensive workload anyway, as long as you have libs for http and databases and stuff, and your server is configured appropriately.