adds endpoint for removing books

This commit is contained in:
SuperNovaa41 2024-01-24 18:44:46 -05:00
parent 42f2db6295
commit d002416131
2 changed files with 7 additions and 1 deletions

View File

@ -63,6 +63,8 @@ std::string remove_book(std::string id)
char* args[] = {(char*) program_name.c_str(), (char*) remove.c_str(), (char*) id.c_str(), NULL};
exec_code = run_isbn_program(args);
switch (exec_code) {
case FORK_FAILED:
perror("removing book, failed to fork");

View File

@ -29,7 +29,11 @@ int main()
return crow::response(add_new_book(isbn));
});
CROW_ROUTE(app, "/remove/<string>")
([](std::string id)
{
return crow::response(remove_book(id));
});
app.port(18080).run();