Coding Challenge: Visited Countries

Let's practice how to send data from fields to the server in the form of a JSON object.

We'll cover the following

Problem statement

The goal of this exercise is to send your traveling info to a server. Data is expected as a JSON object containing two fields:

  • A name field representing your name. Its value is a string.
  • A countries field representing the countries you already visited. Its value is an array of objects. Each object has a name field (string) for the country name, and a year field (integer) for the year you last visited it.

This data must be sent to the URL https://thejsway-server.herokuapp.com/api/countries. You should receive a confirmation message from the server and display it in the console.

Expected output

Your console output should look like this when your code runs:

Get hands-on with 1400+ tech skills courses.