blog.michal-wt.com

I made a website in C++ and it was very easy - let’s talk about Flux 2

03.10.2022 14:57 dev

A the beginning I would like to explain what Flux is. Flux is a small web application which provides online Unix-like shell. It’s not only a shell. I trying to create small web imitation of the operting system. Now, You can find here an implementation of a virtual file system, executor component and virtual applications. I have some ideas for next releases but now I don’t wanna share it with you.

Here we have a second branch of the project. Flux 1 was written in Java language and it was based on the Play framework. Flux 2 was made in C++. Yep, I know what you think… "C++ and web-apps? What the hell is wrong with you?" Many people thinks that C++ developing is very difficult - many times that is true, but if you want to make fast, lighweight and high-level app It can be very, very easy. Sometimes much easier than with PHP.

Let’s talk a bit about Flux 1

The previous release offerred many features. In addition to all things from Flux 2, we can find manuals for all of the apps. The next thing that has not yet been implemented is a link file. When you go to the link file by the cd command, you will be redirected to another web location.

We have text mode… What about graphical environment? Yep, you can find it but it’s just an initial and unstable version.

Flux 1

How to run it? Type start gui. ;)



Flux 2 – why it was easy?

Flux 2

Yep, we have a lot of stereotypes about C++. As I wrote before, yes, C++ could be difficult as hell. This language is very large and contains many concepts and has big backwards compatibility, for example: the auto word which can be used as an auto type (since C++11) and can inform compiler about automatic memory allocation (old-style c++ - in modern it’s unwanted).

There are many modern and easy to use frameworks and libraries. I have used nlohmann json, httplib and libpqxx – all of them easy to use and clearly documented.

Flux 2 has the MVC architecture and uses map-based routing mechanism. Except that I made a simple cache mechanism based on STL containers.

I don't wanna prove you that it was easy. Try it yourself and check the performance.

Wanna try old Flux 1 shell? It's available until October 7 at: sh.michalt.pl

Check out the new Flux 2 at: sh.michal-wt.com


That’s all now.

See you on the next article! :)

Mistakes or problems? Do you have any suggestions? Leave a comment, and I will fix it! Sometimes, my English leaves a little to be desired. I'm still learning! :)

Comments