summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorMarc Lasch <mlasch@mailbox.org>2015-08-12 00:09:46 +0200
committerMarc Lasch <mlasch@mailbox.org>2015-08-12 00:09:46 +0200
commitaa80b95124752095533cff761c3287d756ca26cd (patch)
treee6a71ca06640dc92041b7c34f4e0925cf3030b97 /src/server.cpp
parent9f7530aa40c4197a8c1979b37baab43ba2e6205f (diff)
downloadnetgraph-aa80b95124752095533cff761c3287d756ca26cd.tar.gz
netgraph-aa80b95124752095533cff761c3287d756ca26cd.zip
not working now
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 222e8ea..3efb51d 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1,16 +1,16 @@
#include <iostream>
#include <string>
#include "mongoose.h"
+#include "apiHandler.h"
using namespace std;
int event_handler(struct mg_connection *conn, enum mg_event ev) {
+ apiHandler MyApiHandler(conn);
+
switch (ev) {
case MG_AUTH: return MG_TRUE;
- case MG_REQUEST:
- if (conn->uri) {
- cout<<conn->request_method<<" "<<conn->uri<<endl;
- } else return MG_FALSE;
+ case MG_REQUEST: return MyApiHandler.processRequest();
default: return MG_FALSE;
}
}
@@ -21,6 +21,7 @@ int main(int argc, char **argv) {
struct mg_server *server = mg_create_server(NULL, event_handler);
mg_set_option(server, "document_root", "./www/");
+ mg_set_option(server, "enable_directory_listing", "no");
mg_set_option(server, "listening_port", server_port.c_str());
cout<<"Staring server on port "<<server_port<<"."<<endl;