Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 1.56 KB

README.md

File metadata and controls

39 lines (31 loc) · 1.56 KB

Make C++ apps with a modern Web UI

About the template

This repo contains everything you need to setup any C++ app with a web interface.
We are using ElectronJS to pack the interface inside a window and AJAX APIs to communicate from the Interface to the app using Json requests

Preview

image


How to use

First, make sure you have Node.js installed
npm --version

Install & Start app

Yarn Node
yarn install
yarn start
npm install
npm start

Changing app behavior

Basic operations :

  • Add your sources inside the template
  • Compile with server.cpp and listener.cpp
  • name your executable app.exe

Default port is 444
You can change the port in the .env file


Handling AJAX Requests

Sending requests from Electron :

It is recommended to have a script folder to handle Json requests between the UI and your executable. You can have a look inside renderer.js to see how it works.
Basically we're sending an API request on an endpoint which is listened by the c++ server file server.cpp

Receiving requests on C++ side :

Have a look inside listener.cpp, there is a basic processRequest() function which processes the received json request.
From there, you should be able to feed the output to your other functions