Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlight the README code examples #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ This library, lev, is a very simple API in C++ that encapsulates commonly used f
to stay close to the libevent API concepts except when there is confusion. It simplifies life-times of
objects. The callback function signatures remain identical--but lev objects can be constructed within the
callback functions.
```
EvHttpRequest evreq(req);
```c++
EvHttpRequest evreq(req);
```
lev is actually just a couple of header file, lev.h, and levhttp.h (if you need a httpserver). Just include
it in your application and start using all the classes--no need to build or install:

```
```c++
class IpAddr;
class EvBaseLoop;
class EvEvent;
Expand All @@ -31,29 +31,29 @@ class EvHttpServer;

Code: An HTTP server using lev. Look at the example section for more.

```
#include "lev.h"
#include "levhttp.h"
using namespace lev;

static
void onHttpHello(struct evhttp_request* req, void* arg)
{
EvHttpRequest evreq(req);
evreq.output().printf("<..>Hello World!<..>");
evreq.sendReply(200, "OK");
}

int main(int argc, char** argv)
{
EvBaseLoop base;
EvHttpServer http(base);

http.addRoute("/hello", onHttpHello);
http.bind("127.0.0.1", 8080);

base.loop();

return 0;
}
```c++
#include "lev.h"
#include "levhttp.h"
using namespace lev;

static
void onHttpHello(struct evhttp_request* req, void* arg)
{
EvHttpRequest evreq(req);
evreq.output().printf("<..>Hello World!<..>");
evreq.sendReply(200, "OK");
}

int main(int argc, char** argv)
{
EvBaseLoop base;
EvHttpServer http(base);

http.addRoute("/hello", onHttpHello);
http.bind("127.0.0.1", 8080);

base.loop();

return 0;
}
```