application.go 652 B

1234567891011121314151617181920212223242526272829303132
  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. case "/users/tickers":
  24. return &users.Tickers{}, true
  25. }
  26. return nil, false
  27. }