adds endpoint for removing books
This commit is contained in:
parent
42f2db6295
commit
d002416131
@ -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};
|
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) {
|
switch (exec_code) {
|
||||||
case FORK_FAILED:
|
case FORK_FAILED:
|
||||||
perror("removing book, failed to fork");
|
perror("removing book, failed to fork");
|
||||||
|
@ -29,7 +29,11 @@ int main()
|
|||||||
return crow::response(add_new_book(isbn));
|
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();
|
app.port(18080).run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user