20 lines
325 B
Go
20 lines
325 B
Go
|
package controller
|
||
|
|
||
|
import (
|
||
|
"elasticstream/source/elastic"
|
||
|
|
||
|
"github.com/elastic/go-elasticsearch/v8"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func Read(c *gin.Context) {
|
||
|
|
||
|
// Read data from the client
|
||
|
data, err := client.Read()
|
||
|
if err != nil {
|
||
|
c.Status(http.StatusInternalServerError)
|
||
|
return
|
||
|
}
|
||
|
c.JSON(http.StatusOK, data)
|
||
|
}
|