blob: 32c5d35067cb0e41228ab9c3ac7559d292583583 [file] [log] [blame]
Ed Tanous0fdddb12017-02-28 11:06:34 -08001#include "crow/ci_map.h"
Ed Tanousf9273472017-02-28 16:05:13 -08002#include "crow/http_parser_merged.h"
3#include "crow/query_string.h"
Ed Tanous0fdddb12017-02-28 11:06:34 -08004//#include "crow/TinySHA1.hpp"
Ed Tanousf9273472017-02-28 16:05:13 -08005#include "crow/app.h"
6#include "crow/common.h"
7#include "crow/dumb_timer_queue.h"
8#include "crow/http_connection.h"
9#include "crow/http_request.h"
10#include "crow/http_response.h"
11#include "crow/http_server.h"
12#include "crow/json.h"
13#include "crow/logging.h"
14#include "crow/middleware.h"
15#include "crow/middleware_context.h"
16#include "crow/mustache.h"
17#include "crow/parser.h"
18#include "crow/routing.h"
Ed Tanous0fdddb12017-02-28 11:06:34 -080019#include "crow/settings.h"
20#include "crow/socket_adaptors.h"
Ed Tanous0fdddb12017-02-28 11:06:34 -080021#include "crow/utility.h"
Ed Tanous0fdddb12017-02-28 11:06:34 -080022#include "crow/websocket.h"
Ed Tanous0fdddb12017-02-28 11:06:34 -080023
Ed Tanous5f34a9c2017-02-28 12:35:13 -080024#include "color_cout_g3_sink.hpp"
Ed Tanousf9273472017-02-28 16:05:13 -080025#include "token_authorization_middleware.hpp"
Ed Tanous99923322017-03-03 14:21:24 -080026#include "webassets.hpp"
Ed Tanousf9273472017-02-28 16:05:13 -080027
Ed Tanous0fdddb12017-02-28 11:06:34 -080028#include <iostream>
29#include <string>
Ed Tanousf9273472017-02-28 16:05:13 -080030#include "ssl_key_handler.hpp"
Ed Tanous0fdddb12017-02-28 11:06:34 -080031
Ed Tanous904063f2017-03-02 16:48:24 -080032#include <webassets.hpp>
33
Ed Tanous99923322017-03-03 14:21:24 -080034int main(int argc, char** argv) {
35 auto worker = g3::LogWorker::createLogWorker();
36 auto handle = worker->addDefaultLogger(argv[0], "/tmp/");
37 g3::initializeLogging(worker.get());
38 auto log_file_name = handle->call(&g3::FileSink::fileName);
39 auto sink_handle = worker->addSink(std::make_unique<crow::ColorCoutSink>(), &crow::ColorCoutSink::ReceiveLogMessage);
Ed Tanous0fdddb12017-02-28 11:06:34 -080040
Ed Tanous99923322017-03-03 14:21:24 -080041 LOG(DEBUG) << "Logging to " << log_file_name.get() << "\n";
Ed Tanous0fdddb12017-02-28 11:06:34 -080042
Ed Tanous99923322017-03-03 14:21:24 -080043 std::string ssl_pem_file("server.pem");
44 ensuressl::ensure_openssl_key_present_and_valid(ssl_pem_file);
Ed Tanous0fdddb12017-02-28 11:06:34 -080045
Ed Tanous99923322017-03-03 14:21:24 -080046 crow::App<crow::TokenAuthorizationMiddleware> app;
Ed Tanous0fdddb12017-02-28 11:06:34 -080047
Ed Tanous99923322017-03-03 14:21:24 -080048 crow::webassets::request_routes(app);
Ed Tanous0fdddb12017-02-28 11:06:34 -080049
Ed Tanous99923322017-03-03 14:21:24 -080050 crow::logger::setLogLevel(crow::LogLevel::DEBUG);
Ed Tanous0fdddb12017-02-28 11:06:34 -080051
Ed Tanous99923322017-03-03 14:21:24 -080052 app.port(18080).run();
Ed Tanous0fdddb12017-02-28 11:06:34 -080053}