Skip to content

Instantly share code, notes, and snippets.

@errzey
Last active August 29, 2015 14:18
Show Gist options
  • Save errzey/213559e2bccf43bcf779 to your computer and use it in GitHub Desktop.
Save errzey/213559e2bccf43bcf779 to your computer and use it in GitHub Desktop.
evhtpexp app = express();
express_cb_s foocb = onGet(app, "/foo",
func void(evreq r, void * a) {
reply(r, "FOOO");
});
express_cb_s barcb = onGet(app, "/bar",
func void(evreq r, void * a) {
reply(r, "BARRR");
});
onData(app,
onGet(app, "/baz",
func void (evreq r, void * a) {
reply(r, "BAZ");
}),
func evhtp_res(evreq r, evbuf_t * buf, void * a) {
printf("Got data baz %s\n", (char *)evbuffer_pullup(buf, -1));
return EVHTP_RES_OK;
});
onData(app, foocb,
func evhtp_res(evreq r, evbuf_t * buf, void * a) {
printf("Got data %s\n", (char *)evbuffer_pullup(buf, -1));
return EVHTP_RES_OK;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment