Vely application runs by processing requests. A request always takes form of URL query (GET or POST) that generally contains input parameters.
A predefined input-param
eter "req" must always be present - it's the name of the request. vely_dispatch_request
(a main Vely request dispatcher) uses "req" input parameter to route the request to the appropriate function that handles it. This handling is based on the names of .v files, i.e. source code files that make up your project.
Certain .v files in a Vely project handle requests - those are files with names that don't start with an underscore ('_'). The request handled by each file is given by its base file name. So for example file "get_stock.v" handles request "get_stock" by implementing a function "void get_stock()" in it. A request that is meant to call this function would have "req=get_stock" in it. The routing of this request to the namesake function will be done automatically by Vely. For instance, such request would be called by URL like:
Note that if your application has only one request-handling .v source file, then "req" parameter may be omitted and any incoming requests will be routed to the code implemented in that file.
If the name of .v file starts with an underscore ("_"), then it is a non_request
Each .v file that handles a request must implement a function with the same base name as that file, and this function is called to handle the request. So in the above example, file "get_stock.v" must implement a function "void get_stock()", and in the code below, it simply outputs text "Hello from get_stock":
@Hello from get_stock
Note that because "req" is a predefined symbol, you cannot use it as a name for any other object (such as variables, functions etc.).
Aside from "req" input parameter, a request can have any number of other input parameters, and based on them, perform any number of actions. A "request" generally refers to one or more actions that, based on some criteria, are grouped together under a single request.