response.go 499 B

1234567891011121314151617181920212223
  1. package routes
  2. import (
  3. "fmt"
  4. "net/http"
  5. utils "github.com/nchursin/formtgbot/api/utils"
  6. "github.com/nchursin/formtgbot/redis"
  7. structs "github.com/nchursin/formtgbot/structs"
  8. tg "github.com/nchursin/formtgbot/telegram"
  9. )
  10. func Response(w http.ResponseWriter, r *http.Request) {
  11. var parsedBody structs.Vacancy
  12. utils.ParseJson(r.Body, &parsedBody)
  13. fmt.Printf("Incoming request %s\n", parsedBody)
  14. redis.Store(&parsedBody)
  15. tg.GetBot().SendMessage(&parsedBody)
  16. fmt.Fprintf(w, "Logged")
  17. }