-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00158f8
commit 5430de1
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Servy.VideoCam do | ||
@doc """ | ||
Simulates sending a request to an external API | ||
to get a snapshot image from a video camera. | ||
""" | ||
def get_snapshot(camera_name) do | ||
# CODE GOES HERE TO SEND A REQUEST TO THE EXTERNAL API | ||
|
||
# Sleep for 1 second to simulate that the API can be slow: | ||
:timer.sleep(1000) | ||
|
||
# Example response returned from the API: | ||
"#{camera_name}-snapshot.jpg" | ||
end | ||
end |
5430de1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iex -S mix
spawn(Servy.HttpServer, :start, [4000])
curl http://localhost:4000/snapshots
GET requests and snapshots delay