-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (25 loc) · 814 Bytes
/
main.cpp
File metadata and controls
34 lines (25 loc) · 814 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
#include <nodepp/nodepp.h>
#include <express/https.h>
using namespace nodepp;
void onMain() {
ssl_t ssl; // ( "ssl/cert.key", "ssl/cert.crt" );
auto app = express::https::add( &ssl );
app.USE([]( express_https_t cli, function_t<void> next ){
console::log( "this is a middleware" );
next();
});
app.GET("/test",[]( express_https_t cli ){
cli.status(200)
.header( "content-type", "text/plain" )
.send("this is a test");
});
app.GET([]( express_https_t cli ){
cli.status(200)
.header( "content-type", "text/plain" )
.send("Hello World!");
});
app.listen( "localhost", 8000, []( socket_t ){
console::log( "server started at:" );
console::log( "https://localhost:8000" );
});
}