Last active
February 3, 2019 03:01
-
-
Save FagnerMartinsBrack/99888db9392ae5945f0724ff82ee90af to your computer and use it in GitHub Desktop.
(Medium) - Evolvable APIs
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
const response = await fetch('http://clinic.example.com/booking?intendedDoctor=jane', { | |
method: 'get' | |
}); | |
const availableTimeSlotsForTheWeek = await response.json(); | |
await fetch('http://clinic.example.com/booking', { | |
method: 'post', | |
body: JSON.stringify({ | |
username: 'mary.doe', | |
intendedDoctor: 'jane', | |
time: chooseValidTimeFor('2018-05-01T10:20:00Z', availableTimeSlotsForTheWeek) | |
booking: 'Consultation with Doctor Jane' | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment