-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
register_and_login #4
Conversation
main.go
Outdated
@@ -47,6 +199,10 @@ func main() { | |||
|
|||
router.HandleFunc("/api/ads", getAllPlaces).Methods("GET") | |||
|
|||
router.HandleFunc("/api/auth/register", registerUser).Methods("POST") | |||
router.HandleFunc("/api/auth/login", loginUser).Methods("POST") | |||
router.HandleFunc("/api/auth/logout", logoutUser).Methods("POST") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
повторяющийся элемент /api можно вынести в отдельную переменную или сделать несколько отдельных более длинных
main.go
Outdated
|
||
_, err := rand.Read(b) | ||
if err != nil { | ||
log.Fatalf("Failed to generate random session ID: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Fatalf только в main ф-и используй
main.go
Outdated
{ID: 3, Username: "kerla", Password: "kerla123", Email: "kerla1337@example.com"}, | ||
{ID: 4, Username: "animeLover", Password: "neruto", Email: "nikitasuper@example.com"}, | ||
} | ||
|
||
var places = []Place{ | ||
{ID: 1, Title: "Уютный диван в центре города", Description: "Привет! Я предлагаю место на своем диване для путешественников.", Location: "Moscow", Host: Host{ID: 1, Username: "johndoe", Email: "johndoe@example.com"}, AvailableDates: []string{"2024-05-01", "2024-05-15"}, Rating: 9.1}, | ||
{ID: 1, Title: "Приглашаю иностранцев к себе", Description: "Хаюшки, приезжайте все ко мне!.", Location: "Sochi", Host: Host{ID: 2, Username: "oleg", Email: "oleg228@example.com"}, AvailableDates: []string{"2024-05-01", "2024-05-15"}, Rating: 10}, | ||
{ID: 1, Title: "Нет места, где переночевать?", Description: "Приючу у себя людей на пару дней.", Location: "Chita", Host: Host{ID: 3, Username: "kerla", Email: "kerla1337@example.com"}, AvailableDates: []string{"2024-05-01", "2024-05-15"}, Rating: 8.5}, | ||
{ID: 1, Title: "Хочу поболтать с японцами", Description: "Охае, приезжайте ко мне, анимешники", Location: "Khabarovsk", Host: Host{ID: 4, Username: "animeLover", Email: "nikitasuper@example.com"}, AvailableDates: []string{"2024-05-01", "2024-05-15"}, Rating: 8.8}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вынеси моки в отдельный файл, уж очень засоряют код
No description provided.