library-manager/api/main.cpp

38 lines
509 B
C++
Raw Normal View History

2024-01-18 13:36:24 -05:00
#include <crow.h>
#include <crow/app.h>
#include <fstream>
2024-01-18 13:36:24 -05:00
#include "csv.h"
#include "isbn-interaction.h"
2024-01-18 13:36:24 -05:00
std::string print_hello()
{
return "server is running!";
2024-01-18 13:36:24 -05:00
}
int main()
{
crow::SimpleApp app;
CROW_ROUTE(app, "/")([](){
return crow::response(print_hello());
});
CROW_ROUTE(app, "/books")([](){
return crow::response(get_all_books());
});
CROW_ROUTE(app, "/add/<string>")
([](std::string isbn)
{
return crow::response(add_new_book(isbn));
});
2024-01-18 13:36:24 -05:00
app.port(18080).run();
}