FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
libhttpserver/examples/benchmark_select.cpp at master · VelsonWang/libhttpserver · GitHub
VelsonWang
/
libhttpserver
Public
forked from
etr/libhttpserver
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
libhttpserver
/
examples
/
benchmark_select.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
41 lines (30 loc) · 961 Bytes
Breadcrumbs
libhttpserver
/
examples
/
benchmark_select.cpp
Copy path
File metadata and controls
executable file
·
41 lines (30 loc) · 961 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
35
36
37
38
39
40
41
#
include
<
cstdlib
>
#
include
<
memory
>
#
include
<
httpserver.hpp
>
#
define
PATH
"
/plaintext
"
#
define
BODY
"
Hello, World!
"
using
namespace
httpserver
;
class
hello_world_resource
:
public
http_resource
{
public:
hello_world_resource
(
const
std::shared_ptr<http_response>& resp):
resp
(resp)
{
}
const
std::shared_ptr<http_response>
render
(
const
http_request&) {
return
resp;
}
private:
std::shared_ptr<http_response> resp;
};
int
main
(
int
argc,
char
** argv)
{
webserver ws =
create_webserver
(
atoi
(argv[
1
]))
.
start_method
(http::http_utils::
INTERNAL_SELECT
)
.
max_threads
(
atoi
(argv[
2
]));
std::shared_ptr<http_response> hello = std::shared_ptr<http_response>(
new
string_response
(
BODY
,
200
));
hello->
with_header
(
"
Server
"
,
"
libhttpserver
"
);
hello_world_resource
hwr
(hello);
ws.
register_resource
(
PATH
, &hwr,
false
);
ws.
start
(
true
);
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL