Skip to content
Jurek Muszyński edited this page Mar 28, 2024 · 15 revisions

bool REQ(const char *string)

Description

Compares the first part of the request URI (resource) with string. 'First part' means everything until / or ?, for example:

URI Catched by
/calc?first=2&second=3 REQ("calc")
/customers/123 REQ("customers")
/about.html REQ("about.html")

Returns

Returns true if resource matches string, otherwise false.

Example

// in npp_app_main

if ( REQ("calc") )
    process_calc();
else if ( REQ("about") )
    render_about();
else if ( REQ("") )
    render_landing();
else
    RES_STATUS(404);
Clone this wiki locally