开发 C++ Web 应用程序的最佳方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1036359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 18:29:26  来源:igfitidea点击:

What is the best way to develop a C++ web application?

c++web-applications

提问by user32262

What could be the best way of developing a C++ web application? The web app would be run on Apache HTTP server. How can you overcome challenges like sessions, persistence, context switching, multithreading etc with C++? How could one utilize C++ in best possible way to make it work like Servlets?

开发 C++ Web 应用程序的最佳方式是什么?Web 应用程序将在 Apache HTTP 服务器上运行。您如何使用 C++ 克服会话、持久性、上下文切换、多线程等挑战?如何以最佳方式利用 C++ 使其像 Servlet 一样工作?

回答by the_drow

Take a look at Wt.

看看Wt

Wt (pronounced 'witty') is a C++ library and application server for developing and deploying web applications. It is not a 'framework', which enforces a way of programming, but a library.

The API is widget-centric, and inspired by existing C++ Graphical User Interface (GUI) APIs. To the developer, it offers complete abstraction of any web-specific implementation details, including event handling and graphics support.

Wt(发音为“witty”)是一个用于开发和部署 Web 应用程序的 C++ 库和应用程序服务器。它不是一个强制执行编程方式的“框架”,而是一个库。

该 API 以小部件为中心,并受现有 C++ 图形用户界面 (GUI) API 的启发。对于开发人员,它提供了任何特定于 Web 的实现细节的完整抽象,包括事件处理和图形支持。

It's not free for commercial use though.

虽然它不是免费用于商业用途。

回答by Artyom

Use C++ web framework like CppCMSif you like web-like development, it is oriented for high performance and works with .

如果您喜欢类似 Web 的开发,请使用 C++ Web 框架(如CppCMS),它面向高性能并与 .

It provides:

它提供:

  • FastCGI, SCGI and CGI interfaces.
  • Form processing and validation
  • HTML Templates system
  • Session management
  • Cache system
  • Transparent scale up to numerous servers.
  • FastCGI、SCGI 和 CGI​​ 接口。
  • 表单处理和验证
  • HTML模板系统
  • 会话管理
  • 缓存系统
  • 透明扩展到多个服务器。

You may give a try to Wtbut it is much more like writing GUI using browser rather then traditional web development tool.

您可以尝试使用Wt,但它更像是使用浏览器而不是传统的 Web 开发工具编写 GUI。

回答by nsanders

I'm saying this as a C++ developer...

我是作为 C++ 开发人员这么说的...

I would probably consider using Java instead. Since Java is much more commonly used for this, you'll find way more existing libraries to leverage. If you ever want to hire more people, you'll have an easier time finding web-app Java developers than web-app C++ developers.

我可能会考虑改用 Java。由于 Java 更常用于此目的,您将找到更多现有库来利用。如果您想雇用更多的人,与网络应用程序 C++ 开发人员相比,您将更容易找到网络应用程序 Java 开发人员。

If you insist using C++, check out:

如果您坚持使用 C++,请查看:

http://rudeserver.com/

http://rudeserver.com/

回答by Viet

You can use Qt framework, Boost & Poco libraries to do web development in C++. Qt & Poco have DB support for various RDBMS. You may look into Axis C++ if you need to develop web services in C++. ClearSilver has C library to handle CGI and you can use C++ on top of it. Plenty of choices for you!

您可以使用 Qt 框架、Boost 和 Poco 库在 C++ 中进行 Web 开发。Qt & Poco 为各种 RDBMS 提供 DB 支持。如果您需要使用 C++ 开发 Web 服务,您可以查看 Axis C++。ClearSilver 有 C 库来处理 CGI,你可以在它之上使用 C++。多种选择供您选择!

回答by Max Lybbert

How can you overcome challenges like sessions, persistence, context switching, multithreading etc with C++?

您如何使用 C++ 克服会话、持久性、上下文切换、多线程等挑战?

The answer is what you'd expect it to be: pick libraries that handle issues when possible (multithreading) and implement libraries where necessary (generating a session key and storing it somewhere like a database).

答案是您所期望的:尽可能选择处理问题的库(多线程)并在必要时实现库(生成会话密钥并将其存储在数据库等位置)。

回答by Walt C.

Take a look at the Snorkel Embedded Web Server SDK. Its easy to use and produces the fastest web application solutions. http://sites.google.com/site/snorkelembedded

查看 Snorkel 嵌入式 Web 服务器 SDK。它易于使用并生成最快的 Web 应用程序解决方案。http://sites.google.com/site/snorkelembedded

回答by Sumeet

Try experimenting with the ffead-cppframework, check out the home page for more information...

尝试使用ffead-cpp框架进行试验,查看主页以获取更多信息...