Skip to content

First iteration#1

Open
xails-git wants to merge 7 commits intomainfrom
first-iteration
Open

First iteration#1
xails-git wants to merge 7 commits intomainfrom
first-iteration

Conversation

@xails-git
Copy link
Owner

No description provided.

Copy link

@dirtymew dirtymew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет Алексей

работа принята - но есть комментарии, обрати внимание

logger := log.New(os.Stdout, "SERVER:", log.LstdFlags)
srv := server.New(logger)

logger.Println("Запуск сервера...")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут в лог стоило добавить порт на котором сервер запускается

}

w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write(data)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ошибка не обработана


// Формируем абсолютный путь к index.html
indexPath := filepath.Join(wd, "index.html")
data, err := os.ReadFile(indexPath)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно проще

http.ServeFile

// Парсинг формы с увеличенным лимитом памяти
if err := r.ParseMultipartForm(maxMemory); err != nil {
log.Printf("Ошибка парсинга формы: %v", err)
http.Error(w, "Bad Request", http.StatusBadRequest)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

по заданию статус при ошибках http.StatusInternalServerError

}

func isMorse(s string) bool {
return regexp.MustCompile(`^[\s.\-/]+$`).MatchString(s)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше использовать strings.ContainsFunc чем регулярки

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants