|
1 | 1 | # Nodepp |
| 2 | +> **The DOOM of Async Frameworks: Write Once, Build Everywhere, Process Everything.** |
| 3 | +
|
| 4 | +[](https://opensource.org/licenses/MIT) |
| 5 | +[](https://github.com/NodeppOfficial/nodepp) |
| 6 | +[](https://github.com/NodeppOfficial/nodepp/actions) |
| 7 | + |
| 8 | +Nodepp is a groundbreaking open-source project that simplifies C++ application development by bridging the gap between the language's raw power and the developer-friendly abstractions of Node.js. |
2 | 9 |
|
3 | 10 | Nodepp is a groundbreaking open-source project that simplifies C++ application development by bridging the gap between the language's raw power and the developer-friendly abstractions of Node.js. By providing a high-level API, Nodepp empowers developers to write C++ code in a familiar, Node.js-inspired style. |
4 | 11 |
|
@@ -40,17 +47,31 @@ target_link_libraries( #[...] |
40 | 47 | - 📌: **Scalability:** Build applications that can handle large workloads and grow with your needs. |
41 | 48 | - 📌: **Open-source:** Contribute to the project's development and customize it to your specific requirements. |
42 | 49 |
|
43 | | -## Bateries Included |
| 50 | +## Projects made with NodePP |
| 51 | + |
| 52 | +- 🔗: [Computer Vision VR Controllers for phones Demo](https://github.com/PocketVR/Barely_VR_AR_Controller_Test) |
| 53 | +- 🔗: [Draw on your PC using your smartphone](https://github.com/ScreenDraw/PCDraw) |
| 54 | +- 🔗: [Simple multiplayer Game With Raylib](https://medium.com/@EDBCBlog/create-your-own-online-multiplayer-small-fast-and-fun-with-raylib-nodepp-and-websockets-190f5c174094) |
| 55 | +- 🔗: [Cursed Luna - A simple Raylib Game](https://github.com/EDBCREPO/Space-Shocker) |
| 56 | +- 🔗: [Smart Card Reader(Nodepp-Arduino)](https://github.com/EDBCREPO/emv-reader) |
| 57 | +- 🔗: [Serial Port arduino using Nodepp](https://github.com/EDBCREPO/Arduino_PC) |
| 58 | +- 🔗: [Simple Raylib Real-Time Chat](https://github.com/EDBCREPO/simple-raylib-websocket-chat) |
| 59 | +- 🔗: [Simple Bitget Trading Bot](https://github.com/EDBCREPO/simple-binance-bot-nodepp) |
| 60 | + |
| 61 | +Check out some articles on [Medium](https://medium.com/@EDBCBlog) |
| 62 | + |
| 63 | +## Batteries Included |
44 | 64 |
|
45 | 65 | - 📌: Include a **build-in JSON** parser / stringify system. |
46 | 66 | - 📌: Include a **build-in RegExp** engine for processing text strings. |
47 | | -- 📌: Include Support for **UTF** manipulation | **UTF8 - UTF16 - UTF32** |
| 67 | +- 📌: Include support for **UTF** manipulation | **UTF8 - UTF16 - UTF32** |
48 | 68 | - 📌: Include a **build-in System** that make every object **Async Task** safety. |
49 | 69 | - 📌: Include a **Smart Pointer** base **Garbage Collector** to avoid **Memory Leaks**. |
50 | 70 | - 📌: Include support for **Reactive Programming** based on **Events** and **Observers**. |
51 | 71 | - 📌: Include an **Event Loop** that can handle multiple events and tasks on a single thread. |
52 | 72 | - 📌: Include support for **TCP | TLS | UDP | HTTP | WS** making it easy to create networked applications. |
53 | | -- 📌: Include Support for **Poll | Epoll | Kqueue | WSAPoll** making it easy to handle multiple file descriptors. |
| 73 | +- 📌: Include support for **Poll | Epoll | Kqueue | WSAPoll** making it easy to handle multiple file descriptors. |
| 74 | +- 📌: Include support for **Worker isolated event-loop** making it easy to create distributed self-contained event-loops. |
54 | 75 |
|
55 | 76 | ## Build & Run |
56 | 77 | ```bash |
@@ -160,6 +181,47 @@ void onMain(){ |
160 | 181 | } |
161 | 182 | ``` |
162 | 183 |
|
| 184 | +### Worker Isolated Event-Loop |
| 185 | +```cpp |
| 186 | +#include <nodepp/nodepp.h> |
| 187 | +#include <nodepp/worker.h> |
| 188 | +#include <nodepp/os.h> |
| 189 | + |
| 190 | +using namespace nodepp; |
| 191 | + |
| 192 | +atomic_t<int> shared_variable = 100; |
| 193 | + |
| 194 | +void local_main( int cpu_id ){ |
| 195 | + |
| 196 | + // this event-loop runs in it's own isolated worker-thread |
| 197 | + |
| 198 | + process::add( coroutine::add( COROUTINE(){ |
| 199 | + thread_local static int variable; |
| 200 | + // this will create a static variable per thread |
| 201 | + static atomic_t<int> shared_variable; |
| 202 | + // this will create a shared global variable |
| 203 | + int local_variable; |
| 204 | + // this is a normal variable only exists here |
| 205 | + coBegin |
| 206 | + |
| 207 | + while( shared_variable-->0 ){ |
| 208 | + console::log( cpu_id, "->", shared_variable.get() ); |
| 209 | + coDelay(1000); } |
| 210 | + |
| 211 | + coFinish |
| 212 | + })); |
| 213 | + |
| 214 | +} |
| 215 | + |
| 216 | +void onMain(){ |
| 217 | + |
| 218 | + for( auto x=os::cpus(); x-->0; ){ worker::add([=](){ |
| 219 | + local_main( x ); process::wait(); |
| 220 | + return -1; }); } |
| 221 | + |
| 222 | +} |
| 223 | +``` |
| 224 | +
|
163 | 225 | ### More Examples [here](https://nodeppofficial.github.io/nodepp-doc/guide.html) |
164 | 226 |
|
165 | 227 | ## Installing Nodepp |
@@ -197,18 +259,6 @@ void onMain() { |
197 | 259 | - 🔗: [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino) |
198 | 260 | - 🔗: [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm) |
199 | 261 |
|
200 | | -## Projects made with NodePP |
201 | | -- 🔗: [Computer Vision VR Controllers for phones Demo](https://github.com/PocketVR/Barely_VR_AR_Controller_Test) |
202 | | -- 🔗: [Draw on your PC using your smartphone](https://github.com/ScreenDraw/PCDraw) |
203 | | -- 🔗: [Simple multiplayer Game With Raylib](https://medium.com/@EDBCBlog/create-your-own-online-multiplayer-small-fast-and-fun-with-raylib-nodepp-and-websockets-190f5c174094) |
204 | | -- 🔗: [Cursed Luna - A simple Raylib Game](https://github.com/EDBCREPO/Space-Shocker) |
205 | | -- 🔗: [Smart Card Reader(Nodepp-Arduino)](https://github.com/EDBCREPO/emv-reader) |
206 | | -- 🔗: [Serial Port arduino using Nodepp](https://github.com/EDBCREPO/Arduino_PC) |
207 | | -- 🔗: [Simple Raylib Real-Time Chat](https://github.com/EDBCREPO/simple-raylib-websocket-chat) |
208 | | -- 🔗: [Simple Bitget Trading Bot](https://github.com/EDBCREPO/simple-binance-bot-nodepp) |
209 | | - |
210 | | -Check out some articles on [Medium](https://medium.com/@EDBCBlog) |
211 | | - |
212 | 262 | ## Official Libraries for Nodepp |
213 | 263 | - 🔗: [ExpressPP](https://github.com/NodeppOfficial/nodepp-express) -> Express equivalent for Nodepp |
214 | 264 | - 🔗: [ApifyPP](https://github.com/NodeppOfficial/nodepp-apify) -> Socket.io equivalent for Nodepp |
|
0 commit comments