Skip to content

Commit d8ad395

Browse files
committed
Added post requests
1 parent 8f2f744 commit d8ad395

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

web_server/main.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,18 @@ int main(int argc, const char** argv) {
7272
resp.set_content(FixText(corrector, req.get_param_value("text")), "text/plain");
7373
});
7474

75+
srv.Post("/fix", [&corrector](const httplib::Request& req, httplib::Response& resp) {
76+
resp.set_content(FixText(corrector, req.body), "text/plain");
77+
});
78+
7579
srv.Get("/candidates", [&corrector](const httplib::Request& req, httplib::Response& resp) {
7680
resp.set_content(GetCandidates(corrector, req.get_param_value("text")), "text/plain");
7781
});
7882

83+
srv.Post("/candidates", [&corrector](const httplib::Request& req, httplib::Response& resp) {
84+
resp.set_content(GetCandidates(corrector, req.body), "text/plain");
85+
});
86+
7987
std::cerr << "[info] starting web server at localhost:" << port << std::endl;
8088
srv.listen("localhost", port);
8189
return 0;

0 commit comments

Comments
 (0)