application.go 596 B

123456789101112131415161718192021222324252627282930
  1. package example_chat_test
  2. import (
  3. "log"
  4. "git.ali33.ru/fcg-xvii/rest"
  5. "git.ali33.ru/fcg-xvii/rest/example_chat/chat"
  6. "git.ali33.ru/fcg-xvii/rest/example_chat/users"
  7. )
  8. func NewApplication(chat *chat.Chat) *Application {
  9. //rApp := rest_websocket.NewApplication(ctx)
  10. return &Application{
  11. Chat: chat,
  12. //Application: rApp,
  13. }
  14. }
  15. type Application struct {
  16. *chat.Chat
  17. }
  18. func (s *Application) Executer(r rest.IRequestIn) (rest.IExecuter, bool) {
  19. log.Println("COMMAND", r.RCommand())
  20. switch r.RCommand() {
  21. case "/users/register":
  22. return &users.Register{}, true
  23. }
  24. return nil, false
  25. }