File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ def devserver(name, port):
55 Label ("@rules_devserver//devserver:main" ),
66 Label ("@rules_devserver//devserver:httplib" )
77 ],
8+ args = ["--port=%d" % port ],
89 linkopts = ["-lpthread" ],
910 )
Original file line number Diff line number Diff line change 22
33int main (int argc, char **argv) {
44 httplib::Server svr;
5+ std::string port = " 8080" ;
6+
7+ for (int i = 0 ; i < argc; i++) {
8+ if (std::string (argv[i]).rfind (" --port" , 0 ) != std::string::npos) {
9+ port = std::string (argv[i]).substr (7 );
10+ }
11+ }
512
613 svr.Get (" /" , [](const httplib::Request &req, httplib::Response &res) {
7- res.set_content (" Hello World!" , " text/plain " );
14+ res.set_content (" Hello World!" , " text/html " );
815 });
916
10- svr.listen (" localhost" , 8080 );
17+ svr.listen (" localhost" , std::stoi (port) );
1118}
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ load("//devserver:defs.bzl", "devserver")
22
33devserver (
44 name = "serve" ,
5- port = 8080 ,
5+ port = 8081 ,
66)
You can’t perform that action at this time.
0 commit comments