Skip to content
Jurek edited this page Apr 10, 2019 · 12 revisions

bool REQ(const char *string)

Description

Compares the first part of request URI 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 first part of request URI matches string, otherwise false.

Example

// in silgy_app_main

if ( REQ("calc") )
    process_calc(ci);
else if ( REQ("about") )
    gen_page_about(ci);
else if ( REQ("") )
    gen_page_main(ci);
else
    RES_STATUS(404);
Clone this wiki locally