summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index ccca2ad..c66c6ec 100644
--- a/main.cpp
+++ b/main.cpp
@@ -10,6 +10,23 @@
#include <boost/thread.hpp>
+void foo_handler(HTTP::Connection::p connection) {
+ std::cout << "Handling!" << std::endl;
+
+ HTTPResponse res(connection->socket);
+
+ MusicListing::p ml = music::get(connection->path);
+ if(ml) {
+ res.code = 200;
+ res.status = "OK";
+
+ ml->render(connection, res);
+ } else {
+ res.code = 404;
+ res.status = "Not Found";
+ }
+}
+
int main(int argc, char **argv) {
try {
config::init();
@@ -20,6 +37,9 @@ int main(int argc, char **argv) {
boost::asio::io_service io_service;
HTTP::Server httpd(io_service, tcp::endpoint(tcp::v6(), config::vm["audist.httpd_port"].as<int>()));
+
+ httpd.add_handler("files", &foo_handler);
+
telnet::Server telnetd(io_service, tcp::endpoint(tcp::v6(), config::vm["audist.telnetd_port"].as<int>()));
std::size_t num_threads = config::vm["audist.threads"].as<std::size_t>();