Esempio n. 1
0
static int ev_handler(struct mg_connection *conn, enum mg_event ev) 
{
    wxLogDebug("%s, RUI: %s, TYPE: %s", conn->request_method, conn->uri, event_to_name(ev));
    if (ev == MG_AUTH) return MG_TRUE;

    return MG_FALSE;
}
Esempio n. 2
0
static int ev_handler(struct mg_connection *conn, enum mg_event ev) 
{
    wxLogDebug("%s, RUI: %s, TYPE: %s", conn->request_method, conn->uri, event_to_name(ev));
    if (ev == MG_AUTH) return MG_TRUE;
    int result = MG_FALSE;

    if (ev == MG_REQUEST) 
    {
        if (strcmp(conn->uri, "/account") == 0)
        {
            mg_printf_data(conn, Model_Account::instance().all().to_json().c_str());
            result = MG_TRUE;
        }
        else if (strcmp(conn->uri, "/payee") == 0)
        {
            mg_printf_data(conn, Model_Payee::instance().all().to_json().c_str());
            result = MG_TRUE;
        }
        else
            result = MG_FALSE;
    } 

    return result;
}