Skip to content

Instantly share code, notes, and snippets.

@kevcmk
Last active November 13, 2020 17:42
Show Gist options
  • Save kevcmk/1a72e00107dddb1e89a0d01cac6613f7 to your computer and use it in GitHub Desktop.
Save kevcmk/1a72e00107dddb1e89a0d01cac6613f7 to your computer and use it in GitHub Desktop.
Simple Queue readme.

NOTE: This should be hosted in a separate gist. The candidate will not be able to access this repository.

Simplequeue README (Candidate)

Background

The New York Times hosts a simple, RESTful FIFO queueing service at:

https://nyt-techhiring-prd.ue.r.appspot.com

Its Swagger documentation is available at:

https://nyt-techhiring-prd.ue.r.appspot.com/v1/docs/

Challenge

Your challenge is to use this existing API to implement a one-way teletype, or in modern terms, a one-way text-messenger. Feel free to implement this in any way you see fit--we've included animations of both a command-line solution and a browser solution at the end of this document.

Before we begin, select an alphanumeric [a-zA-Z0-9] queue ID to use. This API has no authentication, so we'll just pass our messages through a queue ID unique enough to not collide with other candidates currently using this (public) API.

  1. Begin by writing the sender. It should take user text input and, each time the user hits Enter or "send", should submit it to the queue (as a string). You may use the command line, a web form, or any other interface you see fit for providing text input.

  2. Continue on to writing the receiver. It should display the contents of your queue using the API's GET endpoint. When invoked, it should display all the queue's contents (from the beginning of time); there's no need to store your "offset" between separate runs. Keep in mind, the GET API is paginated using an offset parameter.

  3. Finally, connect the two components into into our teletype text-messenger. The goal is that all typed text is transmitted from the sender to the receiver (see the below animations). Use whatever means/timing you deem appropriate to print new elements as they arrive over time. There's no need to persist your position in the queue between separate invocations.

When complete, your tool(s) should look a bit like one of the following figures:

Command Line

Browser (using Javascript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment