This example will show you how to quickly create a REST service in GOLANG. (Without Database support)
Use the package manager dep to install dependencies for this project.
cd src/restservice
go run main.go
server will be up at http://localhost:8000
REST CALLS
Endpoint : http://localhost:8000/api/sayhello
Method : GET
Output :
{
"data": {
"name": "Rajshekar",
"phone": "+91-9922616111",
"email": "[email protected]"
},
"message": "success",
"status": true
}
Endpoint : http://localhost:8000/api/sayhello
Method : POST
Input :
{"name":"Json","phone":"9922616111","email":"[email protected]"}
Output :
{
"data": {
"name": "Json",
"phone": "9922616111",
"email": "[email protected]"
},
"message": "success",
"status": true
}