Go
Supports Go1.x
, that means it updates to latest version of Go.
Function declaration
In Go you can declare your function in small or big case. The usual big case are accessible throughout modules. A Public function needs to satify following conditions:-
Should use
package main
at the top.Function name in Capital Case.
Return type must be
string, error
.string
return must be encapsulated insideResponse
struct; and called with methodsend()
.The above function needs be declared in
router.go
as final step.
and router.go
as;
NOTE: ,
needs to be present after declaring function. (Important step)
Request is a type that is shown as;
Args
is a string to interface map and has following keys.
can retrieve information about request from here.
Restrictions
Module name cannot be
func.go
.Returns
json
with keysdata, error
.
Example
Hello World in Go.
This returns response as json
;
Last updated