fix: routes health check

This commit is contained in:
Jonas Kaninda
2024-11-15 08:19:22 +01:00
parent fca775dd5f
commit cb31faf65f
4 changed files with 34 additions and 4 deletions

View File

@@ -142,3 +142,17 @@ func ParseDuration(durationStr string) (time.Duration, error) {
}
return duration, nil
}
func Slug(text string) string {
// Convert to lowercase
text = strings.ToLower(text)
// Replace spaces and special characters with hyphens
re := regexp.MustCompile(`[^\w]+`)
text = re.ReplaceAllString(text, "-")
// Remove leading and trailing hyphens
text = strings.Trim(text, "-")
return text
}