1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-03-17 20:28:06 +02:00
2020-12-26 15:21:29 +00:00
..
2020-12-26 15:17:20 +00:00
2020-12-26 15:21:29 +00:00

REST API

This is an example of how to serve REST behind the API using go-restful

Getting Started

Run Micro API

$ micro api --handler=http

Run Greeter Service

go run greeter/srv/main.go

Run Greeter API

go run rest.go

Curl API

curl http://localhost:8080/greeter

Output

{
  "message": "Hi, this is the Greeter API"
}

Test a resource

 curl http://localhost:8080/greeter/asim

Output

{
  "msg": "Hello asim"
}