eedb/src/app/main.cpp
Wieczorek Bartosz 963d829464 refactoring
2017-03-05 18:06:04 +01:00

27 lines
811 B
C++

#include "Application.hpp"
#include "DatabaseConnection.hpp"
#include <eedb/auth/Services.hpp>
#include <eedb/db/connection.hpp>
#include <Wt/WApplication>
#include <Wt/WServer>
Wt::WApplication * createApplication(const Wt::WEnvironment & env) {
auto dbConnection = eedb::DbConnection{}.create(env);
return eedb::Application{}.create(env, std::move(dbConnection));
}
int main(int argc, char ** argv) {
try {
Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
server.addEntryPoint(Wt::Application, createApplication);
eedb::auth::Services::configureAuth();
server.run();
} catch(Wt::WServer::Exception & e) {
std::cerr << e.what() << std::endl;
} catch(std::exception & e) {
std::cerr << "exception: " << e.what() << std::endl;
}
}