Routing

Routing in Bast is very simple and efficient. It follows the routing convention of Laravel and Adonis. A simple example is shown below

from bast import Route

route = Route()
route.get('/', 'ExampleController.index')

Bast Routes support GET, POST, PUT and DELETE requests.

Routing Methods

class bast.route.Route[source]

Route Class. Appends the URL, Controller Instance and Method to a list instance to be passed on to the server instance

Route.get(url, controller)[source]

Gets the Controller and adds the route, controller and method to the url list for GET request

Route.post(url, controller)[source]

Gets the Controller and adds the route, controller and method to the url list for the POST request

Route.put(url, controller)[source]

Gets the Controller and adds the route, controller and method to the url list for PUT request

Route.delete(url, controller)[source]

Gets the Controller and adds the route, controller and method to the url list for the DELETE request

Route.middleware(args)[source]

Appends a Middleware to the route which is to be executed before the route runs

Route.__return_controller__(controller)[source]
Route.all()[source]

Returns the list of URL. Used by Server to get the list of URLS. This is passed to the Bast HTTP Server