Web Framework

BigConnect has its own minimalistic, lightning-fast web framework. It provides a thin layer of fundamental web application features without adding much overhead.

The framework provides routing and parameter binding. Routing refers to determining how an application responds to a client request to a particular endpoint, which is a URI (or path) and a specific HTTP request method (GET, POST, and so on). Each route can have one or more handler functions, which are executed when the route is matched.

Route definition takes the following structure: app.METHOD (path, handlers) where:

Route handlers need to satisfy one requirement: they need to have a method annotated with the Handle annotation. This method will be called by the framework once the route matches.

Handler methods can also have parameters that will be bound automatically to request parameters, based on their type or name. There are also two annotations available to bind request parameters:

  • Optional - the parameter is optional

  • Required - the parameter is required and the framework will throw an exception if it's not set in the incoming request