Add namespace
This commit is contained in:
8
main.cpp
8
main.cpp
@@ -1,17 +1,17 @@
|
||||
#include "request.hpp"
|
||||
#include "response.hpp"
|
||||
#include "router.hpp"
|
||||
|
||||
using namespace http;
|
||||
|
||||
int main() {
|
||||
|
||||
Router router(8080);
|
||||
http::Router router(8080);
|
||||
// Allow all Methods
|
||||
router.Handle("/helloWorld", [](Request req, Response res) -> Response {
|
||||
res.SetPayload("Hello World!");
|
||||
res.SetContentType("text/plain");
|
||||
return res;
|
||||
});
|
||||
|
||||
|
||||
// Only allow GET
|
||||
router.Handle("GET /echo/{name}", [](Request req, Response res) -> Response {
|
||||
std::string name = req.path.Get("name").value_or("No Name given");
|
||||
|
||||
Reference in New Issue
Block a user