Overview
Leaf v1.4.2 includes a core controller which you can extend to create your own controllers. This gives you access to a bunch of handy functions for use in your app.
Including the Controller
To include the Controller object in a route, use this:
Controller Methods
Responses new in v1.4.2
Leaf Core controller contains methods to appropriately return data to the user.respond
respond returns json encoded data to the user.
respondWithCode
respond returns json encoded data to the user along with an HTTP code.
View Response Docx for all Response methods
Veins
Veins simply help you pass data from the controller to the view, Vein itself can serve as a view layer on it's own.configure
Basic configuration for veins
veins_dir
refers to the directory in which your veins(View Layer Code) are keptcache_dir
refers to the directory in which compiled veins(View Layer Code) are keptset
Pass information to your view. It takes in one parameter, an array ofitems to pass into the view
You can access the name value passed into the view:
render
Outputs a vein(view)
veins_dir
refers to the directory in which your veins(View Layer Code) are keptView Veins Docx for all Vein methods
file_upload
file_upload is for simple file uploads. It takes in 3 parameters, the path to save the file, the file and the file type(optional).
objectify
Objectify converts an array to an object.
Next Steps
Simple RoutingResponse
Simple Authentication
Database Config