diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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>(); |