-
Notifications
You must be signed in to change notification settings - Fork 2
/
pollMain.cpp
45 lines (34 loc) · 1.12 KB
/
pollMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <Wt/WServer>
#include <Wt/Dbo/SqlConnectionPool>
#include "dbo/pollSession.h"
#include "pollResource.h"
int main( int argc, char ** argv) {
try {
Wt::WServer server(argv[0], "");
try {
server.setServerConfiguration(argc, argv);
Wt::Dbo::SqlConnectionPool *pollDb
= PollSession::createConnectionPool(server.appRoot() + "newPoll.db");
pollResource res(*pollDb);
server.addResource(&res, "/api");
try {
server.start();
Wt::WServer::waitForShutdown();
server.stop();
} catch(Wt::WServer::Exception& e) {
std::cout << e.what() << std::endl;
return 1;
}
return 0;
} catch( Wt::WServer::Exception& e) {
std::cout << e.what() << std::endl;
return 1;
} catch( std::exception& e) {
std::cout << e.what() << std::endl;
return 1;
}
}catch(Wt::WServer::Exception& e) {
std::cout << e.what() << std::endl;
return 1;
}
}