Fat API Bindings of C++ Objects into Scripting Languages -- Russell K. Standish
How do you expose a C++ object to a TypeScript layer or other scripting language? Russell K. Standish demonstrates an approach using a RESTService API that is scripting-language independent.
Fat API Bindings of C++ Objects into Scripting Languages
by Russell K. Standish
From the article:
A fat API exposes nearly all of a C++ object’s public attributes and methods to a consuming environment, such as a scripting language, or web client. This can be contrasted with a conventional, or thin API, where the API is defined up front, and the C++ object provides the implementation, most of which is private to the C++ layer.
Obviously, reflection is required to expose C++ objects to a consuming layer like this – this paper explores using the Classdesc system to implement reflection of C++ objects into a JavaScript/TypeScript environment via a REST service, and also via a Node.js API module.

Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Last time, we saw how to provide formatting for a simple user-defined class. Spencer Collyer builds on this, showing how to write a formatter for more complicated types.
The conclusion of the last post was that we need to change something in our models: maybe std::vector should use a different strategy when erasing elements; maybe types like std::tuple<int &> should not be allowed to be stored in a vector; maybe Qt should not be using memmove when erasing objects of trivially relocatable type (but it can still optimize the reallocation of a vector); maybe Qt’s definition of trivial relocability does not match ours, and we need to fix our definitions. In this post we will explore these possibilities and reach some conclusions.
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
In the last post of this series we started exploring how to erase an element from the middle of a vector.