moved uv to io
This commit is contained in:
parent
ab33fce01b
commit
55aa4f7fa1
@ -1,7 +1,7 @@
|
|||||||
CXX=clang++
|
CXX=clang++
|
||||||
CFLAGS=-std=c++11 -Wall
|
CFLAGS=-std=c++11 -Wall
|
||||||
LDFLAGS=-luv -lhttp_parser
|
LDFLAGS=-luv -lhttp_parser
|
||||||
INC=-I./
|
INC=-I../
|
||||||
SOURCES=$(wildcard *.cpp)
|
SOURCES=$(wildcard *.cpp)
|
||||||
EXECUTABLE=test.out
|
EXECUTABLE=test.out
|
||||||
# OBJECTS=$(SOURCES:.cpp=.o)
|
# OBJECTS=$(SOURCES:.cpp=.o)
|
||||||
@ -9,7 +9,7 @@ EXECUTABLE=test.out
|
|||||||
all: $(EXECUTABLE)
|
all: $(EXECUTABLE)
|
||||||
|
|
||||||
$(EXECUTABLE): $(SOURCES)
|
$(EXECUTABLE): $(SOURCES)
|
||||||
$(CXX) $(LDFLAGS) $(SOURCES) -o $(EXECUTABLE) $(CFLAGS)
|
$(CXX) $(LDFLAGS) $(SOURCES) -o $(EXECUTABLE) $(CFLAGS) $(INC)
|
||||||
|
|
||||||
# .cpp.o:
|
# .cpp.o:
|
||||||
# $(CXX) $(CFLAGS) $< -o $@ $(LDFLAGS) $(INC)
|
# $(CXX) $(CFLAGS) $< -o $@ $(LDFLAGS) $(INC)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef MEMGRAPH_SERVER_HTTP_CONNECTION_HPP
|
#ifndef MEMGRAPH_SERVER_HTTP_CONNECTION_HPP
|
||||||
#define MEMGRAPH_SERVER_HTTP_CONNECTION_HPP
|
#define MEMGRAPH_SERVER_HTTP_CONNECTION_HPP
|
||||||
|
|
||||||
#include "uv/uv.hpp"
|
#include "io/uv/uv.hpp"
|
||||||
|
|
||||||
#include "httpparser.hpp"
|
#include "httpparser.hpp"
|
||||||
#include "request.hpp"
|
#include "request.hpp"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
#include "uv/uv.hpp"
|
#include "io/uv/uv.hpp"
|
||||||
#include "httpparsersettings.hpp"
|
#include "httpparsersettings.hpp"
|
||||||
#include "httpconnection.hpp"
|
#include "httpconnection.hpp"
|
||||||
#include "request.hpp"
|
#include "request.hpp"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "uv/uv.hpp"
|
#include "io/uv/uv.hpp"
|
||||||
#include "status_codes.hpp"
|
#include "status_codes.hpp"
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef MEMGRAPH_SPEEDY_HPP
|
#ifndef MEMGRAPH_SPEEDY_HPP
|
||||||
#define MEMGRAPH_SPEEDY_HPP
|
#define MEMGRAPH_SPEEDY_HPP
|
||||||
|
|
||||||
#include "http/uv/uv.hpp"
|
#include "io/uv/uv.hpp"
|
||||||
#include "http/http.hpp"
|
#include "http/http.hpp"
|
||||||
|
|
||||||
namespace speedy
|
namespace speedy
|
||||||
@ -10,11 +10,10 @@ namespace speedy
|
|||||||
class Speedy
|
class Speedy
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
uv::UvLoop loop;
|
|
||||||
http::HttpServer server;
|
http::HttpServer server;
|
||||||
http::Ipv4 ip;
|
http::Ipv4 ip;
|
||||||
public:
|
public:
|
||||||
Speedy(const http::Ipv4& ip);
|
Speedy(uv::UvLoop& loop, const http::Ipv4& ip);
|
||||||
void get(const std::string path, http::request_cb_t callback);
|
void get(const std::string path, http::request_cb_t callback);
|
||||||
void listen();
|
void listen();
|
||||||
~Speedy();
|
~Speedy();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
namespace speedy
|
namespace speedy
|
||||||
{
|
{
|
||||||
|
|
||||||
Speedy::Speedy(const http::Ipv4& ip) : server(loop), ip(ip)
|
Speedy::Speedy(uv::UvLoop& loop, const http::Ipv4& ip) : server(loop), ip(ip)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,8 +21,6 @@ void Speedy::listen()
|
|||||||
});
|
});
|
||||||
|
|
||||||
std::cout << "Server is UP" << std::endl;
|
std::cout << "Server is UP" << std::endl;
|
||||||
|
|
||||||
loop.run(uv::UvLoop::Mode::Default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Speedy::~Speedy()
|
Speedy::~Speedy()
|
||||||
|
@ -4,9 +4,13 @@
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
uv::UvLoop loop;
|
||||||
http::Ipv4 ip("0.0.0.0", 3400);
|
http::Ipv4 ip("0.0.0.0", 3400);
|
||||||
speedy::Speedy app(ip);
|
|
||||||
|
speedy::Speedy app(loop, ip);
|
||||||
app.listen();
|
app.listen();
|
||||||
|
|
||||||
|
loop.run(uv::UvLoop::Mode::Default);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user