Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ on the back end of web app

I have been searching the web for this information and I think I need some help with understanding this better.

I would like to learn how to write back-end of a web application in C++ and essentially how to output C++ to web pages and make it talk to a MySQL database. For the record I can write decent code in C++ but I never did it for web.

Wherever I go on the web and find people asking about this the first list of responses is WHY would you when yo have scripting languages. I am aware of the scripting languages, I have used them for years but I am running across cases where this is a requirement and I would like to learn more about it.

My intent it to write an app that uses Angularjs on the front and C++ on the back. I am a fairly well versed PHP developer and I might take this task on by writing PHP initially but I do need to account for a possibility of rewriting in C++ and this makes me think I should probably write it in C++ from the get go.

I understand that the most usual question is WHY I would use C++ instead of a scripting language so I will try and give a limited set of reasons. Please do understand I am not a pro in this aspect of C++ yet and I am evaluating the situation I am in.

So here are some of my reasons...

  1. The project I am about to take on is bound to be very resource intensive and I would really like to gain all the speed I can possibly get from the get go. The more control I have over the app process the better. Essentially I need precision, I know and love C++ and it allows me to retain the control to a great degree..

  2. The group of people I am talking to in the context of the project are aware of the advantages of C++ fro the resources and speed perspective and they hold a portion of the investment bag which gives them a vote in how the project will be approached. Time IS on my side, but i want to waste as little of it as possible.

  3. I am comfortable with C++, have a C++ oriented mind and would love to use it in this context as much as possible.

So I guess my questions are...

  1. Is there a good tutorial that can take me from the basics to something intermediate?
  2. How do I write a web site backend in C++?
  3. How do I write C++ to work with MySQL on Linux.
  4. Is there a way to do this on Linux servers? (I believe Facebook it doing it).

I found this http://www.compileonline.com/compile_cpp_online.php on http://www.compileonline.com and it is giving me hope but I need more information to know how to get there.

I am aware that I am not asking an example code based question but I often find good reference posts on Stack that answer these types of questions so I hope someone can help me. I feel a bit lost here.

like image 906
GRowing Avatar asked Mar 07 '14 19:03

GRowing


People also ask

Can C be used for back-end?

Some of the backend programming languages used to create dynamic websites are C, C++, Java, Ruby, PHP, . Net and Python.

What is the back-end of a web application?

The backend (or “server-side”) is the portion of the website you don't see. It's responsible for storing and organizing data, and ensuring everything on the client-side actually works. The backend communicates with the frontend, sending and receiving information to be displayed as a web page.

Is C language front end or backend?

C++: It is a general-purpose programming language and is widely used nowadays for competitive programming. It is also used as a backend language.

Is C used in web?

C is general-purpose and one of the oldest yet commonly used languages in web development. It is the basis of other programming languages, such as C++ and JavaScript. It is a middle-level programming language that is versatile since it can be used for scripting for drivers and kernels and software applications.


1 Answers

My preferred approach to building angular apps is to use the back-end pretty much strictly as a REST server.

Here are a few places that list options:

I'm searching a cgi lib in C to build a restful web service

and

How popular is C++ for making websites/web applications?

and

https://softwareengineering.stackexchange.com/questions/147445/how-does-one-interface-c-with-the-web-at-google-for-example

One option that seems to come up multiple times is http://cppcms.com/. Also http://www.webtoolkit.eu

Integrating angular will be pretty much the same as integrating with any other back-end. If you're using the back-end as a REST server you can pretty much statically serve all of the angular code.

like image 161
urban_raccoons Avatar answered Oct 26 '22 23:10

urban_raccoons