Controller
Last updated
Last updated
A controller's purpose is to receive specific requests for the application. The routing mechanism controls which controller receives which requests. Frequently, each controller has more than one route, and different routes can perform different actions.
Syntax for create controller in Tinh Tinh:
Method available in controller
Use(...Middleware)
function for common middleware
Guard(...Guard)
function for check forbidden as middleware
Version(string)
function mark version for controller or routes
Registry()
function registry for group middleware to use for all routes in controller
Pipe(...Pipe)
validate and transform dto
Get(string, Handler)
registry Get Http
Post(string, Handler)
registry Post Http
Put(string, Handler)
registry Put Http
Patch(string, Handler)
registry Patch Http
Delete(string, Handler)
registry Delete Http
Handler(string, http.Handler)
registry Handler for pure http.Handler
Inject(Provide)
get provider with name in module