From 96e2ce2e9d363a6296f9411ecb00168520258874 Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Mon, 29 Jul 2024 02:47:35 +0300 Subject: Отказ от echo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/date.go | 7 ------- utils/middleware.go | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) delete mode 100644 utils/date.go create mode 100644 utils/middleware.go (limited to 'utils') diff --git a/utils/date.go b/utils/date.go deleted file mode 100644 index 3a6197d..0000000 --- a/utils/date.go +++ /dev/null @@ -1,7 +0,0 @@ -package utils - -import "time" - -func FormatDate(ts int64) string { - return time.Unix(ts, 0).Format("15:04 02.01.2006") -} diff --git a/utils/middleware.go b/utils/middleware.go new file mode 100644 index 0000000..c297d65 --- /dev/null +++ b/utils/middleware.go @@ -0,0 +1,8 @@ +package utils + +import "net/http" + +// Middleware in itself simply takes a http.Handler as the first parameter, wraps +// it and returns a new http.Handler for the server to call (wraps handlers with +// closures according to the principle of Russian doll). +type Middleware func(http.Handler) http.Handler -- cgit v1.2.3