Skip to content

Commit 2f39a65

Browse files
committed
📌 Nodepp | Stable Release | V1.3.0 📌
1 parent fe9c8e4 commit 2f39a65

File tree

154 files changed

+3772
-1908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+3772
-1908
lines changed

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: edbc_repo # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Nodepp C++ Cross-Platform CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build_and_test:
11+
# 1. Define the runners for the matrix strategy
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
17+
# 2. Use the matrix variable to set the runner OS
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: ⬇️ Checkout code
22+
uses: actions/checkout@v4
23+
24+
# --- 🧪 Unit Test Compilation and Run ---
25+
26+
- name: 🧪 Unit Test (Linux/macOS)
27+
# Uses -lssl -lcrypto -lpthread flags
28+
if: runner.os != 'Windows'
29+
run: |
30+
echo "Running Unix-like Unit Test build..." ; cd ./test
31+
g++ -o main main.cpp -I../include -lpthread ; ./main
32+
33+
- name: 🧪 Unit Test (Windows)
34+
# Uses -lssl -lcrypto -lws2_32 flags
35+
if: runner.os == 'Windows'
36+
run: |
37+
echo "Running Windows Unit Test build..." ; cd ./test
38+
g++ -o main main.cpp -I../include -lws2_32; ./main.exe
39+
40+
# --- End of the workflow ---

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
main.exe
2+
main

CMakeLists.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
cmake_minimum_required(VERSION 4.0.0)
1+
cmake_minimum_required(VERSION 3.0.0)
2+
project(nodepp VERSION 1.3.0)
23

3-
project(nodepp VERSION 1.0.0)
4-
5-
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD 11)
65
set(CMAKE_CXX_STANDARD_REQUIRED ON)
76
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8-
97
set(NODEPP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
108

9+
# Search for ZLIB
10+
find_package(ZLIB REQUIRED)
11+
if(NOT ZLIB_FOUND)
12+
message(FATAL_ERROR "ZLIB not found. Please install libz-dev or equivalent files.")
13+
endif()
14+
1115
# Search for OpenSSL
1216
find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL)
1317
if(NOT OpenSSL_FOUND)
14-
message(FATAL_ERROR "OpenSSL not found. Please install OpenSSL development files.")
18+
message(FATAL_ERROR "OpenSSL not found. Please install libopenssl-dev or equivalent files.")
1519
endif()
1620

17-
# Search for ZLIB
18-
find_package(ZLIB REQUIRED)
19-
if(NOT ZLIB_FOUND)
20-
message(FATAL_ERROR "ZLIB not found. Please install ZLIB development files.")
21-
endif()
21+
# interface-target
22+
add_library(nodepp INTERFACE)
23+
target_include_directories(nodepp INTERFACE ${NODEPP_INCLUDE_DIR})
24+
target_link_libraries(nodepp INTERFACE -lssl -lcrypto -lz $<$<OR:$<BOOL:${MSVC}>,$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>:ws2_32> )

README.md

Lines changed: 102 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,34 @@ Nodepp is a groundbreaking open-source project that simplifies C++ application d
44

55
One of the standout features of Nodepp is its 100% asynchronous architecture, powered by an internal Event Loop. This design efficiently manages Nodepp’s tasks, enabling you to develop scalable and concurrent applications with minimal code. Experience the power and flexibility of Nodepp as you streamline your development process and create robust applications effortlessly!
66

7-
## Dependencies
7+
🔗: [Nodepp The MOST Powerful Framework for Asynchronous Programming in C++](https://medium.com/p/c01b84eee67a)
8+
9+
## Dependencies & Cmake Integration
810
```bash
911
# Openssl
1012
🪟: pacman -S mingw-w64-ucrt-x86_64-openssl
1113
🐧: sudo apt install libssl-dev
12-
1314
# Zlib
1415
🪟: pacman -S mingw-w64-ucrt-x86_64-zlib
1516
🐧: sudo apt install zlib1g-dev
1617
```
18+
```bash
19+
include(FetchContent)
20+
21+
FetchContent_Declare(
22+
nodepp
23+
GIT_REPOSITORY https://github.com/NodeppOfficial/nodepp
24+
GIT_TAG origin/main
25+
GIT_PROGRESS ON
26+
)
27+
FetchContent_MakeAvailable(nodepp)
28+
29+
#[...]
30+
31+
target_link_libraries( #[...]
32+
PUBLIC nodepp #[...]
33+
)
34+
```
1735

1836
## Features
1937

@@ -47,17 +65,36 @@ One of the standout features of Nodepp is its 100% asynchronous architecture, po
4765
```
4866

4967
## Examples
50-
### Hello world
68+
69+
### Reading JSON
5170
```cpp
5271
#include <nodepp/nodepp.h>
72+
#include <nodepp/json.h>
5373

5474
using namespace nodepp;
5575

56-
void onMain() {
57-
console::log("Hello World!");
58-
}
76+
void onMain() {
77+
78+
auto data = json::parse( R"({
79+
"var1": 10,
80+
"var2": false,
81+
"var3": "hello world",
82+
"var4": { "var5": "nested object" },
83+
"var5": [ 10, 20, 30, 40, 50, 60, 70 ]
84+
})" );
85+
86+
console::log( "var1:", data["var1"].as<uint>() );
87+
console::log( "var2:", data["var2"].as<bool>() );
88+
console::log( "var3:", data["var3"].as<string_t>() );
89+
console::log( "var4:", data["var4"]["var5"].as<string_t>() );
5990

60-
// note that we are using onMain() instead of main()
91+
console::log( "\n --- \n" );
92+
93+
for( auto x: data["var5"].as<array_t<object_t>>() ){
94+
console::log( "var5", x.as<uint>() );
95+
}
96+
97+
}
6198
```
6299

63100
### HTTP Client
@@ -103,16 +140,16 @@ using namespace nodepp;
103140

104141
void onMain(){
105142

106-
auto server = http::server([=]( http_t cli ){
143+
auto server = http::server([=]( http_t cli ){
107144

108145
console::log( cli.path, cli.get_fd() );
109-
146+
110147
cli.write_header( 200, header_t({
111148
{ "content-type", "text/html" }
112149
}));
113-
150+
114151
cli.write( date::fulltime() );
115-
cli.close(); // optional | GC automaticaly close unused sockets
152+
cli.close(); // optional
116153

117154
});
118155

@@ -123,9 +160,45 @@ void onMain(){
123160
}
124161
```
125162

126-
### More Examples [here](https://github.com/NodeppOfficial/Nodepp/tree/main/examples)
163+
### More Examples [here](https://nodeppofficial.github.io/nodepp-doc/guide.html)
164+
165+
## Installing Nodepp
166+
167+
### Clone The Repository
168+
```bash
169+
#!/usr/bin/env bash
170+
git clone https://github.com/NodeppOfficial/nodepp ; cd nodepp
171+
```
172+
173+
### Create a main.cpp File
174+
```bash
175+
#!/usr/bin/env bash
176+
touch main.cpp
177+
```
178+
```cpp
179+
#include <nodepp/nodepp.h>
180+
181+
using namespace nodepp;
182+
183+
void onMain() {
184+
console::log("Hello World!");
185+
}
186+
```
187+
188+
### Build Your Code
189+
```bash
190+
#!/usr/bin/env bash
191+
🐧: g++ -o main main.cpp -O3 -I ./include ; ./main #(Linux)
192+
🪟: g++ -o main main.cpp -O3 -I ./include -lws2_32 ; ./main #(Windows)
193+
```
194+
195+
## Nodepp Supports Other Platforms Too
196+
- 🔗: [NodePP for Window | Linux | Mac | Bsd ](https://github.com/NodeppOfficial/nodepp)
197+
- 🔗: [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino)
198+
- 🔗: [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm)
127199

128200
## Projects made with NodePP
201+
- 🔗: [Computer Vision VR Controllers for phones Demo](https://github.com/PocketVR/Barely_VR_AR_Controller_Test)
129202
- 🔗: [Draw on your PC using your smartphone](https://github.com/ScreenDraw/PCDraw)
130203
- 🔗: [Simple multiplayer Game With Raylib](https://medium.com/@EDBCBlog/create-your-own-online-multiplayer-small-fast-and-fun-with-raylib-nodepp-and-websockets-190f5c174094)
131204
- 🔗: [Cursed Luna - A simple Raylib Game](https://github.com/EDBCREPO/Space-Shocker)
@@ -136,26 +209,24 @@ void onMain(){
136209

137210
Check out some articles on [Medium](https://medium.com/@EDBCBlog)
138211

139-
## Compatibility
140-
- 🔗: [NodePP for Window | Linux | Mac | Bsd ](https://github.com/NodeppOfficial/nodepp)
141-
- 🔗: [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino)
142-
- 🔗: [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm)
143-
144212
## Official Libraries for Nodepp
145-
- 🔗: [ExpressPP](https://github.com/NodeppOfficial/nodepp-express) -> Express equivalent for Nodepp
146-
- 🔗: [ApifyPP](https://github.com/NodeppOfficial/nodepp-apify) -> Socket.io equivalent for Nodepp
147-
- 🔗: [SerialPP](https://github.com/NodeppOfficial/nodepp-serial) -> Serial Port for Nodepp
148-
- 🔗: [Argon2](https://github.com/NodeppOfficial/nodepp-argon2) -> Argon2 for Nodepp
149-
- 🔗: [Torify](https://github.com/NodeppOfficial/nodepp-torify) -> HTTP|Ws over Tor
150-
- 🔗: [NginxPP](https://github.com/NodeppOfficial/nodepp-nginx) -> Reverse Proxy
151-
- 🔗: [InputPP](https://github.com/NodeppOfficial/nodepp-input) -> Fake Inputs
152-
- 🔗: [JWT](https://github.com/NodeppOfficial/nodepp-jwt) -> JSON Web Token
153-
- 🔗: [NmapPP](https://github.com/NodeppOfficial/nodepp-nmap) -> Scan IPs and Ports
154-
- 🔗: [Redis](https://github.com/NodeppOfficial/nodepp-redis) -> Redis Client for Nodepp
155-
- 🔗: [Sqlite](https://github.com/NodeppOfficial/nodepp-sqlite) -> Sqlite Client for Nodepp
156-
- 🔗: [MariaDB](https://github.com/NodeppOfficial/nodepp-mariadb) -> MariaDB Client for Nodepp
157-
- 🔗: [Postgres](https://github.com/NodeppOfficial/nodepp-postgres) -> Postgres Client for Nodepp
158-
213+
- 🔗: [ExpressPP](https://github.com/NodeppOfficial/nodepp-express) -> Express equivalent for Nodepp
214+
- 🔗: [ApifyPP](https://github.com/NodeppOfficial/nodepp-apify) -> Socket.io equivalent for Nodepp
215+
- 🔗: [Bluetooth](https://github.com/NodeppOfficial/nodepp-bluetooth) -> Bluetooth Port for Nodepp
216+
- 🔗: [SerialPP](https://github.com/NodeppOfficial/nodepp-serial) -> Serial Port for Nodepp
217+
- 🔗: [Argon2](https://github.com/NodeppOfficial/nodepp-argon2) -> Argon2 for Nodepp
218+
- 🔗: [Torify](https://github.com/NodeppOfficial/nodepp-torify) -> HTTP|Ws over Tor
219+
- 🔗: [GPUPP](https://github.com/NodeppOfficial/nodepp-gpu) -> GPGPU for Nodepp
220+
- 🔗: [NginxPP](https://github.com/NodeppOfficial/nodepp-nginx) -> Reverse Proxy
221+
- 🔗: [InputPP](https://github.com/NodeppOfficial/nodepp-input) -> Fake Inputs
222+
- 🔗: [XML](https://github.com/NodeppOfficial/nodepp-xml) -> XML for Nodepp
223+
- 🔗: [JWT](https://github.com/NodeppOfficial/nodepp-jwt) -> JSON Web Token
224+
- 🔗: [NmapPP](https://github.com/NodeppOfficial/nodepp-nmap) -> Scan IPs and Ports
225+
- 🔗: [Redis](https://github.com/NodeppOfficial/nodepp-redis) -> Redis Client for Nodepp
226+
- 🔗: [Sqlite](https://github.com/NodeppOfficial/nodepp-sqlite) -> Sqlite Client for Nodepp
227+
- 🔗: [MariaDB](https://github.com/NodeppOfficial/nodepp-mariadb) -> MariaDB Client for Nodepp
228+
- 🔗: [Postgres](https://github.com/NodeppOfficial/nodepp-postgres) -> Postgres Client for Nodepp
229+
159230
## Contribution
160231

161232
If you want to contribute to **Nodepp**, you are welcome to do so! You can contribute in several ways:
@@ -170,5 +241,4 @@ If you want to contribute to **Nodepp**, you are welcome to do so! You can contr
170241
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/edbc_repo)
171242

172243
## License
173-
174244
**Nodepp** is distributed under the MIT License. See the LICENSE file for more details.

examples/0-Terminal_Color.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <nodepp/nodepp.h>
2+
3+
using namespace nodepp;
4+
5+
void onMain() {
6+
7+
conio::background( conio::color::cyan | conio::color::bold );
8+
console::log( "hello world!" );
9+
conio::reset();
10+
11+
conio::foreground( conio::color::red | conio::color::bold );
12+
console::log( "hello world!" );
13+
conio::reset();
14+
15+
conio::background( conio::color::magenta | conio::color::bold );
16+
console::log( "hello world!" );
17+
conio::reset();
18+
19+
conio::foreground( conio::color::blue | conio::color::bold );
20+
console::log( "hello world!" );
21+
conio::reset();
22+
23+
conio::background( conio::color::yellow | conio::color::bold );
24+
console::log( "hello world!" );
25+
conio::reset();
26+
27+
conio::foreground( conio::color::green | conio::color::bold );
28+
console::log( "hello world!" );
29+
conio::reset();
30+
31+
}

examples/14-Event.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ void onMain(){
1212
ev.on([](){ console::done(" World 1 "); });
1313

1414
// create an event that can be emitted once
15-
ev.once([](){ console::done(" hello "); });
15+
ev.on([](){ console::done(" hello "); });
1616

1717
// Emit Events
1818
ev.emit();
19+
console::log( "->", ev.size() );
1920

2021
// Clear Even Queue
2122
ev.clear();
2223

2324
// turn of an specific event
24-
auto item = ev.on([](){ /* logic goes here */ });
25-
26-
ev.off( item );
25+
auto item = ev.on([](){
26+
console::log("me cago en la puta");
27+
});
28+
console::log( "->", ev.size() );
2729

30+
ev.off( item ); ev.emit();
31+
console::log( "->", ev.size() );
2832

2933
}

examples/16-Asyn_Promises.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <nodepp/nodepp.h>
2+
#include <nodepp/timer.h>
3+
#include <nodepp/promise.h>
4+
5+
using namespace nodepp;
6+
7+
void onMain(){
8+
9+
promise_t<int,except_t> prom ([=]( res_t<int> res, rej_t<except_t> rej ){
10+
timer::timeout([=](){ res(10); },1000);
11+
}); prom.emit();
12+
13+
process::add( coroutine::add( COROUTINE(){
14+
coBegin
15+
16+
coWait( prom.is_pending() );
17+
18+
if( !prom.has_value() ){ coEnd; }
19+
20+
if( prom.is_resolved() ){ console::done ( prom.get_value().value() ); }
21+
else /*--------------*/ { console::error( prom.get_value().error() ); }
22+
23+
coFinish
24+
}));
25+
26+
}

0 commit comments

Comments
 (0)