This video is available to students only

Adding a new API endpoint

Setting up a new API endpoint to serve geographic data (UN/LOCODE ports)

Adding a new API endpoint#

For this lesson, we'll return to the server code to create a new API. We'll also add some geographic data to the database.

Adding geographic data to the database#

Add data from the UN/LOCODE dataset to your PostgreSQL databases (the local database and the remote Heroku database) using the provided unlocode.sql file. UN/LOCODE is a great collection of the latitude and longitude points of almost all terminals in the world, including airports, seaports, rail terminals, and many others.

Click here to download the unlocode.sql file.

As with the sales data, you can use the command line to add it, or a client like pgAdmin.

Adding an API endpoint for geographic data#

Add a separate API endpoint to index.js to retrieve the new data.

No discussions yet