package handler

import (
	"net/http"

	"dag-jupyter/internal/logic"
	"dag-jupyter/internal/svc"
	"github.com/zeromicro/go-zero/rest/httpx"
)

func GreetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := logic.NewGreetLogic(r.Context(), svcCtx)
		resp, err := l.Greet()
		if err != nil {
			httpx.Error(w, err)
		} else {
			httpx.OkJson(w, resp)
		}
	}
}
