COMMUNITY

Is a CPPIA MVC possible?

website
haxe-cppia
haxe-python

(Gabriel Hayes) #1

How possible/feasible would it be to create a cppia mvc or some sort of cppia Http sever with similar functionality to Python’s http.server?


(Valentin Lemière) #2

The cpp target can do sockets so it’s possible to create a http server.

If you really want to use cpp then the easiest way would be to find a library that does this and make externs to use it.

Otherwise you have a couple of possibilities:

Using python you can use its module for this, it doesn’t seem to be part of the std so you’ll have to write externs for it too.

There is nodejs using the hxnodejs library which has externs for node’s http server.

The tink_http library can create http server for several targets including node, php and neko.

Not exactly a http server but neko/php can be run by a webserver (nekotools server, apache mod_neko, php itself) and get the required information using haxe.web which may be enough depending on your use case.


(tokiop) #3

Could Monsoon help ? It works well on neko, not sure about cppia implications…


(Gabriel Hayes) #4

How does Cppias performance match up against pythons performance?

I’m aiming for modular services in an MVC format tailored for web applications. Essentially an MVC where C++ routes and dispatches, then the controller can be implemented in any language that can access pipes or the shell. (same for the model)

EDIT: I am using Python’s simple server for example to access an executable on the server that acts as the dispatcher which executes Cppia scripts so that the core of the web applications can be modified without server reboots (plus the manual boasts of cppias speed)

While pythons simple server also offers this, C++ and Cppia I imagine would allow a level of abstraction that allows any x language to be used as the actual server without the need for a vm, just the compiled C++ dispatcher and the Cppia scripts


(Valentin Lemière) #5

I haven’t seen any benchmark but cppia isn’t too far behind hxcpp’s performances so I’d say it’s better.

On that topic know that the haxe cpp target isn’t as fast as raw cpp, because of some of haxe features including dynamic/reflection or the garbage collector.
And the nodejs target can be faster in some cases.

While that’s true a lot of servers will have python (though maybe 2, haxe requires 3) since a lot of linux os use python internally.

In the end since hxcpp/cppia doesn’t have anything for this out of the box personally I’d go with something else like monsoon that @tokiop linked.
You can find managed hosting with python or nodejs, and adding neko support to apache isn’t complex.