O'Reilly logo

Distributed Computing with Go by V.N. Nikhil Anurag

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Concierge server

Let's try to post the book, Hackers: Heroes of the Computer Revolution to the Concierge endpoint, /api/feeder. We need to have the Concierge server running in another terminal window:

    $ curl -X POST -d '{"title": "Hackers: Heroes of Computer Revolution", "url": "http://www.gutenberg.org/cache/epub/729/pg729.txt"}' http://localhost:8080/api/feeder | jq                                                                       
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   162  100    51  100   111     51    111  0:00:01 --:--:--  0:00:01 54000
    {
      "code": 200,
      "msg": "Request is being processed."
    }

Next, let's see what happens on the server:

    $ go run main.go
    2017/11/18 21:05:57 INFO -  Adding API handlers...
    2017/11/18 21:05:57 INFO - Starting feeder... ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required