Controllers are the heart of glim framework. They are responsible for request handling, input validation and return appropriate responses to the requests. When a new glim app is created using $ glim new, app/ will be automatically generated to be used. In glim, all the controllers reside in The simplest controller definition would be the following;

from glim import Controller
from glim import Response

class BaseController(Controller):
    def hello(self):
        return {'error': None, 'msg': 'Hello World'}
        # OR
        # return 'Hello World Mate!'

As it might be noticed glim controllers can detect that the response should be a json response using application/json header. A raw string return would not perform any header set.
In this particular example, hello function can be called as an "action" from an mvc perspective. Notice that string based responses are also automatically handled by glim. The hello function can be mapped to a url in
urls = {
    '/': 'BaseController.hello'

In this example, when you navigate to in your browser, you will notice the Response string being returned.

Controllers are automatically instantiated by glim dispatcher. Dispatcher automatically generates an instance injected to request object so that you don't need to define any functions in the static scope. There exists further information about requests and response in the next section.