-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (23 loc) · 715 Bytes
/
main.cpp
File metadata and controls
34 lines (23 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define NODEPP_ALLOW_PTR_ATOMIC_COUNTER 0
#define NODEPP_ALLOW_ALLOCATOR 0
#include <nodepp/nodepp.h>
#include <nodepp/worker.h>
#include <nodepp/http.h>
#include <nodepp/ws.h>
#include <nodepp/os.h>
using namespace nodepp;
void onParallel(){
auto server = http::server([=]( http_t cli ){
cli.write_header( 200, header_t({
{ "content-type", "text/html" }
}));
cli.write( "hello world!\r\n" );
});
server.onError([=]( except_t err ){
console::log( ">>", err.what() );
});
server.listen( "[::0]", 8000, [=]( socket_t server ){
console::log("server started at http://localhost:8000");
});
}
void onMain(){ onParallel(); }