func CreateDevice(c *gin.Context) { var payload tf.Device c.Bind(&payload) var device tf.Device if err := device.CreateDevice(payload); err != nil { c.String(http.StatusInternalServerError, fmt.Sprintf("Failed to create a new device. Error: %s", err)) } else { c.String(http.StatusOK, "A new device has been created successfully") } }