Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Last active February 3, 2019 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FagnerMartinsBrack/99888db9392ae5945f0724ff82ee90af to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/99888db9392ae5945f0724ff82ee90af to your computer and use it in GitHub Desktop.
(Medium) - Evolvable APIs
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