Skip to content

npp_app_main

Jurek Muszyński edited this page Mar 28, 2024 · 3 revisions

void npp_app_main()

Description

Called after parsing HTTP request header. This is the main entry point for a request.

Returns

None

Example

void npp_app_main()
{
    int ret=OK;

    if ( REQ("login") )
    {
        render_login();
    }
    else if ( REQ("do_login") )
    {
        ret = npp_usr_login();
        if ( ret != OK )
            RES_LOCATION("login?msg=%d", ret);
        else
            RES_LOCATION("dashboard");
    }
    else if ( REQ("dashboard") )
    {
        render_dashboard();
    }
    else if ( REQ("") )
    {
        if ( LOGGED )
            RES_LOCATION("dashboard");
        else
            render_landing();
    }
    else  // page not found
    {
        RES_STATUS(404);
    }
}
Clone this wiki locally