Skip to content

Commit ba587ac

Browse files
committed
Readme.md - updated
1 parent c4cce1e commit ba587ac

File tree

1 file changed

+45
-158
lines changed

1 file changed

+45
-158
lines changed

README.md

Lines changed: 45 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ One of the standout features of Nodepp is its 100% asynchronous architecture, po
1111

1212
🔗: [Nodepp The MOST Powerful Framework for Asynchronous Programming in C++](https://medium.com/p/c01b84eee67a)
1313

14+
## Featured Project: Asynchronous Enigma Machine
15+
16+
To showcase `Nodepp-arduino` efficiency on "bare metal" hardware, we implemented a fully functional Enigma Machine on an Arduino Nano.
17+
18+
- **Zero-Delay Logic:** Real-time 10x4 keypad scanning and rotor substitution without a single `delay()` call.
19+
- **Memory Mastery:** Runs sophisticated multi-tasking logic on only 2KB of RAM using Nodepp’s Zero-Copy primitives ( `ptr_t`, `array_t`, `queue_t` ).
20+
- **Responsive I/O:** Background tasks handle 16x2 LCD updates while encryption processes in background.
21+
22+
[![IMAGE](https://thumbs.wokwi.com/projects/449104127751150593/thumbnail.jpg)](https://wokwi.com/projects/449104127751150593)
23+
24+
Try it now: [Enigma Machine Simulation](https://wokwi.com/projects/449104127751150593)
25+
26+
## Featured Project: Duck Hunt VR (WASM Edition)
27+
28+
To showcase `Nodepp-wasm`, we ported the classic Duck Hunt to Virtual Reality, running natively in the browser via WebAssembly. This project pushes the limits of web-based VR by combining low-level C++ performance with modern Web APIs.
29+
30+
- **Hand Tracking:** Integrated ARToolKitJS to detect physical DIY cardboard markers as a virtual zapper.
31+
- **Web Gyroscope:** Asynchronous event loop provides smooth 360° head tracking via the Web Gyroscope API.
32+
- **High Performance:** Native C++ performance compiled to WASM ensures stable 60 FPS even during camera-stream processing.
33+
34+
Play it now: [Duck Hunt VR on Itch.io](https://edbcrepo.itch.io/duck-hunt-vr)
35+
1436
## Dependencies & Cmake Integration
1537
```bash
1638
# Openssl
@@ -40,8 +62,9 @@ target_link_libraries( #[...]
4062

4163
## Features
4264

43-
- 📌: **Node.js-like API:** Write C++ code in a syntax and structure similar to Node.js, making it easier to learn and use.
44-
- 📌: **High-performance:** Leverage the speed and efficiency of C++ for demanding applications.
65+
- 📌: **Lightweight:** Minimal dependencies, making it ideal for IoT and embedded systems.
66+
- 📌: **Cross-Platform:** Write once, run on Linux, Windows, Mac, Android, WASM and Arduino/ESP32.
67+
- 📌: **Memory Efficient:** Custom ``ptr_t`, `queue_t`, `array_t` and `string_t` primitives provide SSO (Small Stack Optimization) and zero-copy slicing.
4568
- 📌: **Scalability:** Build applications that can handle large workloads and grow with your needs.
4669
- 📌: **Open-source:** Contribute to the project's development and customize it to your specific requirements.
4770

@@ -60,98 +83,28 @@ Check out some articles on [Medium](https://medium.com/@EDBCBlog)
6083

6184
## Batteries Included
6285

63-
- 📌: Include a **build-in JSON** parser / stringify system.
64-
- 📌: Include a **build-in RegExp** engine for processing text strings.
65-
- 📌: Include support for **UTF** manipulation | **UTF8 - UTF16 - UTF32**
66-
- 📌: Include a **build-in System** that make every object **Async Task** safety.
67-
- 📌: Include a **Smart Pointer** base **Garbage Collector** to avoid **Memory Leaks**.
68-
- 📌: Include support for **Reactive Programming** based on **Events** and **Observers**.
69-
- 📌: Include an **Event Loop** that can handle multiple events and tasks on a single thread.
70-
- 📌: Include support for **TCP | TLS | UDP | HTTP | WS** making it easy to create networked applications.
71-
- 📌: Include support for **Poll | Epoll | Kqueue | WSAPoll** making it easy to handle multiple file descriptors.
72-
- 📌: Include support for **Worker isolated event-loop** making it easy to create distributed self-contained event-loops.
73-
74-
## Build & Run
75-
```bash
76-
🐧: g++ -o main main.cpp -O3 -I ./include ; ./main
77-
🪟: g++ -o main main.cpp -O3 -I ./include -lws2_32 ; ./main
78-
```
79-
80-
## Test Unit
81-
```bash
82-
🐧: ( cd ./test; g++ -o main main.cpp -I../include -lssl -lcrypto -lpthread ; ./main )
83-
🪟: ( cd ./test; g++ -o main main.cpp -I../include -lssl -lcrypto -lws2_32 ; ./main )
84-
```
85-
86-
## Examples
87-
88-
### Reading JSON
89-
```cpp
90-
#include <nodepp/nodepp.h>
91-
#include <nodepp/json.h>
92-
93-
using namespace nodepp;
94-
95-
void onMain() {
96-
97-
auto data = json::parse( R"({
98-
"var1": 10,
99-
"var2": false,
100-
"var3": "hello world",
101-
"var4": { "var5": "nested object" },
102-
"var5": [ 10, 20, 30, 40, 50, 60, 70 ]
103-
})" );
104-
105-
console::log( "var1:", data["var1"].as<uint>() );
106-
console::log( "var2:", data["var2"].as<bool>() );
107-
console::log( "var3:", data["var3"].as<string_t>() );
108-
console::log( "var4:", data["var4"]["var5"].as<string_t>() );
86+
- 📌: UTF Support: Comprehensive manipulation for UTF8, UTF16, and UTF32.
87+
- 📌: Networking: Native support for TCP, TLS, UDP, HTTP, and WebSockets.
88+
- 📌: Built-in JSON & RegExp: Full parsing and text processing engines.
89+
- 📌: I/O Multiplexing: Support for Poll, Epoll, Kqueue, and WSAPoll.
90+
- 📌: Reactive Programming: Built-in Events and Observers system.
10991

110-
console::log( "\n --- \n" );
92+
## Quick Start
11193

112-
for( auto x: data["var5"].as<array_t<object_t>>() ){
113-
console::log( "var5", x.as<uint>() );
114-
}
115-
116-
}
94+
### Clone The Repository
95+
```bash
96+
#!/usr/bin/env bash
97+
git clone https://github.com/NodeppOfficial/nodepp ; cd nodepp
11798
```
11899

119-
### HTTP Client
120-
```cpp
121-
//#pragma comment(lib, "Ws2_32.lib") msvc compiler
122-
123-
#include <nodepp/nodepp.h>
124-
#include <nodepp/http.h>
125-
126-
using namespace nodepp;
127-
128-
void onMain(){
129-
130-
fetch_t args;
131-
args.method = "GET";
132-
args.url = "http://www.google.com/";
133-
args.headers = header_t({
134-
{ "Host", url::host(args.url) }
135-
});
136-
137-
http::fetch( args )
138-
139-
.then([]( http_t cli ){
140-
console::log( stream::await( cli ) );
141-
})
142-
143-
.fail([]( except_t err ){
144-
console::error( err );
145-
});
146-
147-
}
100+
### Create a main.cpp File
101+
```bash
102+
#!/usr/bin/env bash
103+
touch main.cpp
148104
```
149-
150-
### HTTP Server
151105
```cpp
152-
//#pragma comment(lib, "Ws2_32.lib") msvc compiler
153-
154106
#include <nodepp/nodepp.h>
107+
#include <nodepp/regex.h>
155108
#include <nodepp/http.h>
156109
#include <nodepp/date.h>
157110

@@ -161,14 +114,14 @@ void onMain(){
161114

162115
auto server = http::server([=]( http_t cli ){
163116

164-
console::log( cli.path, cli.get_fd() );
165-
166117
cli.write_header( 200, header_t({
167118
{ "content-type", "text/html" }
168119
}));
169120

170-
cli.write( date::fulltime() );
171-
cli.close(); // optional
121+
cli.write( regex::format( R"(
122+
<h1> Hello World </h1>
123+
<h2> ${0} </h2>
124+
)", date::fulltime() ));
172125

173126
});
174127

@@ -179,72 +132,6 @@ void onMain(){
179132
}
180133
```
181134

182-
### Worker Isolated Event-Loop
183-
```cpp
184-
#include <nodepp/nodepp.h>
185-
#include <nodepp/worker.h>
186-
#include <nodepp/os.h>
187-
188-
using namespace nodepp;
189-
190-
atomic_t<int> shared_variable = 100;
191-
192-
void worker_main( int cpu_id ){
193-
194-
// this event-loop runs in it's own isolated worker-thread
195-
196-
process::add( coroutine::add( COROUTINE(){
197-
thread_local static int variable;
198-
// this will create a static variable per thread
199-
static atomic_t<int> shared_variable;
200-
// this will create a shared global variable
201-
int local_variable;
202-
// this is a normal variable only exists here
203-
coBegin
204-
205-
while( shared_variable-->0 ){
206-
console::log( cpu_id, "->", shared_variable.get() );
207-
coDelay(1000); }
208-
209-
coFinish
210-
}));
211-
212-
}
213-
214-
void onMain(){
215-
216-
for( auto x=os::cpus(); x-->0; ){ worker::add([=](){
217-
worker_main( x ); process::wait();
218-
return -1; }); }
219-
220-
}
221-
```
222-
223-
### More Examples [here](https://nodeppofficial.github.io/nodepp-doc/guide.html)
224-
225-
## Installing Nodepp
226-
227-
### Clone The Repository
228-
```bash
229-
#!/usr/bin/env bash
230-
git clone https://github.com/NodeppOfficial/nodepp ; cd nodepp
231-
```
232-
233-
### Create a main.cpp File
234-
```bash
235-
#!/usr/bin/env bash
236-
touch main.cpp
237-
```
238-
```cpp
239-
#include <nodepp/nodepp.h>
240-
241-
using namespace nodepp;
242-
243-
void onMain() {
244-
console::log("Hello World!");
245-
}
246-
```
247-
248135
### Build Your Code
249136
```bash
250137
#!/usr/bin/env bash
@@ -257,7 +144,7 @@ void onMain() {
257144
- 🔗: [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino)
258145
- 🔗: [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm)
259146

260-
## Official Libraries for Nodepp
147+
## Ecosystem
261148
- 🔗: [ExpressPP](https://github.com/NodeppOfficial/nodepp-express) -> Express equivalent for Nodepp
262149
- 🔗: [ApifyPP](https://github.com/NodeppOfficial/nodepp-apify) -> Socket.io equivalent for Nodepp
263150
- 🔗: [Bluetooth](https://github.com/NodeppOfficial/nodepp-bluetooth) -> Bluetooth Port for Nodepp

0 commit comments

Comments
 (0)