Take postcodes and get the Lat long information from them I had an interview task which was the final stage, however, the feedback I got back for my solution was that it lacked effort and structure. I would be grateful to know how my solution could be improved. I used postcode.io to get the latitude and longitude from the post codes.
Here is the Description:

Brief: Create a server application that allows a user to input one or more postcodes, and then returns location-specific information
based on the postcode entered.
Requirements: At least one of the external APIs made available to you should be used to retrieve the information that your API returns.
You are not limited to using only one, and are free to use as many of
them as you like (inc. any other external resources) in order to
provide useful data.

Based on the above I made the following program.
app.js
import * as express from &quot;express&quot;;
import * as axios from &quot;axios&quot;;

const app = express();
app.use(express.json());

app.get(&quot;/&quot;, (req, res) =&gt; {
  res.send(&quot;Server is up and running &quot;);
});

app.get(&quot;/postcode/:postcode&quot;, async (req, res) =&gt; {
  const postcode = req.params.postcode;
  await getLatlonFromPostcode(postcode).then((data) =&gt; {
    res.send(data);
  });
});

app.post(&quot;/postcodes&quot;, async (req, res) =&gt; {
  const postCodes = req.body.postcodes;
  const result = await getAdressForMultiplePostCodes(postCodes).then(
    (response) =&gt; {
      return returnLatLonObj(response.result);
    }
  );
  res.json(result);
});

//Return the lat and lon for a single postcode
export async function getLatlonFromPostcode(postcode) {
  try {
    const res = await axios
      .get(`https://api.postcodes.io/postcodes/${postcode}`)
      .then((response) =&gt; {
        const lat = response.data.result.latitude.toString();
        const lon = response.data.result.longitude.toString();
        return `${lat}, ${lon}`;
      });
    return res;
  } catch (error) {
    console.error(error);
  }
}

//Return array of addresses from Postcode array
export async function getAdressForMultiplePostCodes(postcodes) {
  try {
    const res = await axios
      .post(&quot;https://api.postcodes.io/postcodes&quot;, {
        postcodes,
      })
      .then((response) =&gt; {
        return response.data;
      });
    return res;
  } catch (error) {
    console.error(error);
  }
}

//Grab Latitude and Longitude and convert Array to object
function returnLatLonObj(arr) {
  return arr.reduce((prev, curr) =&gt; {
    prev[curr.result.latitude] = curr.result.longitude;
    return prev;
  }, {});
}


export default app;

This is my index.js
import app from &quot;./app&quot;;

app.listen(3000, () =&gt; {
    console.log(&quot;server listening on port 3000&quot;);
})

This was my test file, which I used jest for.
import { getLatlonFromPostcode } from &quot;../app&quot;;

describe(&quot;getLatlonFromPostcode&quot;, () =&gt; {
  test(&quot;it should return latlon for given postcode&quot;, async () =&gt; {
    const latlon = await getLatlonFromPostcode(&quot;ox495nu&quot;);
    expect(latlon).toEqual(&quot;51.655929, -1.069752&quot;);
  });
});

describe(&quot;getLatlonFromPostcode in uppercase&quot;, () =&gt; {
  test(&quot;it should return latlon for given postcode&quot;, async () =&gt; {
    const latlon = await getLatlonFromPostcode(&quot;OX49 5NU&quot;);
    expect(latlon).toEqual(&quot;51.655929, -1.069752&quot;);
  });
});

describe(&quot;getLatlonFromPostcode with spaces between the postcode&quot;, () =&gt; {
  test(&quot;it should return latlon for given postcode&quot;, async () =&gt; {
    const latlon = await getLatlonFromPostcode(&quot;OX49 5NU&quot;);
    expect(latlon).toEqual(&quot;51.655929, -1.069752&quot;);
  });
});
Test case structure
It doesn't seem like the code totally &quot;lacked effort and structure&quot; but the structure, at least of the test cases, could be better. Since all three describe() blocks contain a test that calls getLatlonFromPostcode so there could be a single describe() block with three it() blocks to test the various aspects of how the function should handle given postcodes.
Utilizing await
One of the main benefits of using await is to eliminate the need for callbacks to .then(). Some code utilizes this benefit e.g. the test functions but the methods in app.js do not - e.g.

await getLatlonFromPostcode(postcode).then((data) =&gt; {
  res.send(data);
});


Ideally, the res.send() call would be on a sequential line instead of in a .then() callback function:
const data = await getLatlonFromPostcode(postcode);
res.send(data);

Or even simpler:
res.send(await getLatlonFromPostcode(postcode));

Error handling
As an interviewer I would be checking to see how well the code handles edge cases. Obviously with promises comes rejection. The first couple methods don't appear to handle rejected promises at all.
Import Star
The two import statements import everything from the modules being imported. In the Airbnb style guide, it recommends no wildcards:

Why? This makes sure you have a single default export.1

The import for axios could be simplified using destructuring assignment:
import { get, post} from &quot;axios&quot;;

That way the code can call get() and post() without needing to reference axios, and the other items exported from axios that are not needed are not imported.