-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
30 lines (22 loc) · 737 Bytes
/
main.cpp
File metadata and controls
30 lines (22 loc) · 737 Bytes
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
#include <iostream>
#include <boost/asio.hpp>
#include "server/server.h"
using boost::asio::ip::tcp;
int main() {
try {
// Create an io_context object
boost::asio::io_context io_context;
// Set up an endpoint to listen on
tcp::endpoint endpoint(tcp::v4(), 3737);
// Create a StoreData object
std::string data_file_path = "data/data.json";
StoreData store(data_file_path);
// Create a server object and start accepting connections
Server server(io_context, endpoint, store);
// Run the io_context object
io_context.run();
} catch (std::exception& e) {
std::cerr << "Exception: " << e.what() << std::endl;
}
return 0;
}