likes!
This commit is contained in:
@@ -104,17 +104,19 @@ int main() {
|
||||
});
|
||||
|
||||
svr.Post("/like", [&database, &data_mutex](const httplib::Request& request, httplib::Response& response) {
|
||||
std::string username = request.get_param_value("username");
|
||||
std::string password = request.get_param_value("password");
|
||||
std::string post = request.get_param_value("post");
|
||||
|
||||
std::lock_guard<std::mutex> lock(data_mutex);
|
||||
|
||||
try {
|
||||
std::string username = request.form.get_field("username");
|
||||
std::string password = request.form.get_field("password");
|
||||
std::string post = request.form.get_field("post");
|
||||
|
||||
std::lock_guard<std::mutex> lock(data_mutex);
|
||||
|
||||
uint64_t postNum = std::stoull(post);
|
||||
database.addLike(postNum, 0);
|
||||
} catch (const std::runtime_error& e) {
|
||||
response.set_content("<p>there was an error :( it is: " + std::string(e.what()) + "</p>", "text/html");
|
||||
} catch (const std::exception& e) {
|
||||
response.set_content("<p>there was an error :( it is: " + std::string(e.what()) + "</p>", "text/html");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user