Skip to content

Commit bbac676

Browse files
feat: helmet middleware example in beast2 server.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
1 parent b64bc65 commit bbac676

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

example/server/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <boost/http_proto/request_parser.hpp>
2121
#include <boost/http_proto/serializer.hpp>
2222
#include <boost/http_proto/server/cors.hpp>
23+
#include <boost/http_proto/server/helmet.hpp>
2324
#include <boost/capy/brotli/decode.hpp>
2425
#include <boost/capy/brotli/encode.hpp>
2526
#include <boost/capy/zlib/deflate.hpp>
@@ -80,7 +81,16 @@ int server_main( int argc, char* argv[] )
8081
{
8182
return http_proto::route::next;
8283
});
83-
srv.wwwroot.use("/", serve_static( argv[3] ));
84+
85+
srv.wwwroot.use(
86+
http_proto::helmet(),
87+
[] ( http_proto::route_params& ) ->
88+
http_proto::route_result
89+
{
90+
return http_proto::route::next;
91+
});
92+
93+
srv.wwwroot.use("/", serve_static( argv[3] ));
8494

8595
app.start();
8696
srv.attach();

0 commit comments

Comments
 (0)