title
3.1 API calls from Node.js (Weather data from Dark Sky) - Working with Data and APIs in JavaScript

description
💻https://github.com/CodingTrain/Intro-to-Data-APIs-JS Welcome to Module 3! I covered a lot about node.js in the previous module, but there are still a few key elements left to discuss! In this module, I build the "Weather Here" project (based on example by Joey Lee). In this first video, I demonstrate how to connect to an external API from node.js itself. Later, I'll look at how to hide an API key as well as deploy a project to publicly accessible web server. 🎥 NEXT LESSON: https://youtu.be/Tiot877orkU 🎥 PREVIOUS LESSON: https://youtu.be/q-lUgFxwjEM 🎥 FULL COURSE: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6YxDKpFzf_2D84p0cyk4T7X 🔗 Dark Sky API: https://darksky.net/dev 🔗 Node.js: https://nodejs.org/en/ 🚂 Website: http://thecodingtrain.com/ 💖 Patreon: https://patreon.com/codingtrain 🛒 Store: https://www.designbyhumans.com/shop/codingtrain/ 📚 Books: https://www.amazon.com/shop/thecodingtrain 🎥 Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH 🎥 Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA 🔗 p5.js: https://p5js.org 🔗 Processing: https://processing.org 📄 Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

detail
{'title': '3.1 API calls from Node.js (Weather data from Dark Sky) - Working with Data and APIs in JavaScript', 'heatmap': [{'end': 417.338, 'start': 395.34, 'weight': 0.755}, {'end': 730.67, 'start': 700.763, 'weight': 0.773}, {'end': 792.968, 'start': 760.014, 'weight': 0.755}, {'end': 1014.81, 'start': 983.24, 'weight': 0.848}], 'summary': "Covers building a web application using external apis, focusing on making api requests, hiding api keys, plotting records on a map, and deploying the project. it also explains the process of adding weather functionality to the data selfie app, obtaining weather data from the dark sky api, and implementing api calls to retrieve weather information by geolocating. additionally, it discusses using the fetch api in node.js, resolving 'fetch is not defined' error, and sending latitude and longitude data to the server for weather retrieval.", 'chapters': [{'end': 169.714, 'segs': [{'end': 116.958, 'src': 'embed', 'start': 87.62, 'weight': 0, 'content': [{'end': 90.982, 'text': "So we're going to use two different APIs, one for weather information, one for air quality.", 'start': 87.62, 'duration': 3.362}, {'end': 97.505, 'text': 'One of those APIs is going to require an API key and not actually even allow us to connect from the client side.', 'start': 91.402, 'duration': 6.103}, {'end': 102.868, 'text': "So we're going to have to look at, well, how do I connect to an API from Node but then have the client be able to display that information.", 'start': 97.525, 'duration': 5.343}, {'end': 104.53, 'text': "Because that's going to be a key new thing.", 'start': 102.888, 'duration': 1.642}, {'end': 107.191, 'text': 'I also want to figure out how do I hide the API keys?', 'start': 104.99, 'duration': 2.201}, {'end': 111.795, 'text': "So if I want to open source and publish my code but I don't want to include my API keys, how do I do that?", 'start': 107.211, 'duration': 4.584}, {'end': 113.676, 'text': "So that's going to be an important piece of this as well.", 'start': 111.835, 'duration': 1.841}, {'end': 116.958, 'text': 'This project also allows us to kind of play with our logs page.', 'start': 114.056, 'duration': 2.902}], 'summary': 'Using two apis, one for weather and one for air quality, with a focus on api key handling and client-side display.', 'duration': 29.338, 'max_score': 87.62, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM87620.jpg'}, {'end': 150.877, 'src': 'embed', 'start': 120.161, 'weight': 1, 'content': [{'end': 123.943, 'text': 'how do we pull a bunch of records from the database and plot them on a map?', 'start': 120.161, 'duration': 3.782}, {'end': 130.467, 'text': 'And mostly we can pull from the previous example I made with the International Space Station to create a map with leaflet.js.', 'start': 124.263, 'duration': 6.204}, {'end': 137.311, 'text': "And finally, before I go, before this series wraps up, I really think it's important to talk about deploying a project into the real world,", 'start': 130.948, 'duration': 6.363}, {'end': 137.771, 'text': 'so to speak.', 'start': 137.311, 'duration': 0.46}, {'end': 138.992, 'text': "So right now, I'm tinkering.", 'start': 138.011, 'duration': 0.981}, {'end': 140.072, 'text': "I'm playing around and developing.", 'start': 139.032, 'duration': 1.04}, {'end': 140.972, 'text': "The server's running here.", 'start': 140.112, 'duration': 0.86}, {'end': 142.173, 'text': "The client's running here.", 'start': 141.253, 'duration': 0.92}, {'end': 144.814, 'text': 'This is just all contained within my laptop.', 'start': 142.653, 'duration': 2.161}, {'end': 150.877, 'text': 'But if I want to deploy this project to a server so that it can live on the web, that many people could access it, share the data,', 'start': 145.074, 'duration': 5.803}], 'summary': 'Use leaflet.js to plot records from database on a map, and deploy project to server for web access.', 'duration': 30.716, 'max_score': 120.161, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM120161.jpg'}, {'end': 184.405, 'src': 'embed', 'start': 155.561, 'weight': 2, 'content': [{'end': 159.104, 'text': 'So I want to look at a few different options for deploying your project onto the web.', 'start': 155.561, 'duration': 3.543}, {'end': 164.649, 'text': "Hopefully I'll give you some pointers to some options where you can do that for free, as well as if you have a larger project,", 'start': 159.144, 'duration': 5.505}, {'end': 168.193, 'text': 'what the sort of considerations are for hosting services and paying for hosting.', 'start': 164.649, 'duration': 3.544}, {'end': 169.714, 'text': "So this is where I'm going to begin.", 'start': 168.553, 'duration': 1.161}, {'end': 173.297, 'text': "I've got just sort of the very basic functionality from the Data Selfie app.", 'start': 170.194, 'duration': 3.103}, {'end': 176.679, 'text': "I've stripped away P5, the webcam, images, a lot of stuff.", 'start': 173.357, 'duration': 3.322}, {'end': 179.702, 'text': 'The page just loads and shows my latitude and longitude.', 'start': 176.919, 'duration': 2.783}, {'end': 184.405, 'text': "When I click Check In, it's saving that current latitude and longitude and the timestamp to the database.", 'start': 180.062, 'duration': 4.343}], 'summary': 'Options for deploying project on the web, including free and paid hosting services.', 'duration': 28.844, 'max_score': 155.561, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM155561.jpg'}], 'start': 1.032, 'title': 'Working with data & apis in javascript', 'summary': 'Covers building a web application involving data from external apis and server-side and client-side elements, focusing on making api requests, hiding api keys, plotting records on a map, and deploying the project onto the web.', 'chapters': [{'end': 169.714, 'start': 1.032, 'title': 'Working with data & apis in javascript', 'summary': 'Covers building a web application involving data from external apis and server-side and client-side elements, focusing on making api requests, hiding api keys, plotting records on a map, and deploying the project onto the web.', 'duration': 168.682, 'highlights': ["The chapter explains the process of making API requests to external data sources from the server, involving weather information and air quality, and the need to hide API keys for open-source projects. The project 'The Weather Here' involves connecting to external APIs for weather information and air quality, requiring the retrieval of data from the server and the demonstration of how to hide API keys for open-source projects.", 'It covers the process of plotting a bunch of records from the database on a map using leaflet.js, similar to the example made with the International Space Station. The chapter explores the process of plotting records from the database onto a map, utilizing leaflet.js, and drawing parallels to a previous example involving the International Space Station.', 'The chapter emphasizes the importance of deploying a project onto the web, discussing options for free deployment and considerations for hosting services. The importance of deploying a project onto the web is highlighted, with discussions on free deployment options and considerations for hosting services for larger projects.']}], 'duration': 168.682, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM1032.jpg', 'highlights': ['The chapter covers making API requests to external data sources from the server, involving weather information and air quality, and the need to hide API keys for open-source projects.', 'It explores the process of plotting records from the database onto a map, utilizing leaflet.js, and drawing parallels to a previous example involving the International Space Station.', 'Emphasizes the importance of deploying a project onto the web, discussing options for free deployment and considerations for hosting services.']}, {'end': 710.387, 'segs': [{'end': 297.465, 'src': 'embed', 'start': 260.373, 'weight': 0, 'content': [{'end': 262.034, 'text': 'And it offers the data in JSON format.', 'start': 260.373, 'duration': 1.661}, {'end': 267.918, 'text': "It also, while it's not entirely a free service, it lets you do 1, 000 API calls per day free.", 'start': 262.374, 'duration': 5.544}, {'end': 269.559, 'text': "And that's for demonstration purposes.", 'start': 268.178, 'duration': 1.381}, {'end': 271.04, 'text': "That's pretty much all I need.", 'start': 269.859, 'duration': 1.181}, {'end': 276.721, 'text': "A risk here, of course, is that by the time you're watching this video, the Dark Sky API won't exist anymore,", 'start': 271.44, 'duration': 5.281}, {'end': 278.621, 'text': 'or the way that it works will have completely changed.', 'start': 276.721, 'duration': 1.9}, {'end': 280.462, 'text': "But that's just a fact of life.", 'start': 278.901, 'duration': 1.561}, {'end': 286.123, 'text': 'So, really, what you should be taking away from this video is less the specifics of the Dark Sky API,', 'start': 280.882, 'duration': 5.241}, {'end': 292.804, 'text': 'but what you need to do when you find an API how to get your API key, how to make the request, how to get the data and then present the data.', 'start': 286.123, 'duration': 6.681}, {'end': 297.465, 'text': "And hopefully, maybe follow this video along, but use a completely different weather API while you're following.", 'start': 292.844, 'duration': 4.621}], 'summary': 'Dark sky api offers 1,000 free api calls per day for demonstration purposes, with a caution about potential future changes.', 'duration': 37.092, 'max_score': 260.373, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM260373.jpg'}, {'end': 424.32, 'src': 'heatmap', 'start': 395.34, 'weight': 0.755, 'content': [{'end': 397.261, 'text': "So I'm going to grab this URL.", 'start': 395.34, 'duration': 1.921}, {'end': 401.823, 'text': "So right here, once I've geolocated, then I can make an API URL.", 'start': 397.461, 'duration': 4.362}, {'end': 405.855, 'text': 'which is equal to exactly that.', 'start': 404.315, 'duration': 1.54}, {'end': 417.338, 'text': "but instead of I'm going to make this a string literal, because instead of hard coding in the latitude and longitude, I might as well say latitude,", 'start': 405.855, 'duration': 11.483}, {'end': 424.32, 'text': "comma, longitude, and then now I can say this is all stuff we've done before.", 'start': 417.338, 'duration': 6.982}], 'summary': 'Demonstrating geolocating and constructing an api url using latitude and longitude.', 'duration': 28.98, 'max_score': 395.34, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM395340.jpg'}, {'end': 504.385, 'src': 'embed', 'start': 477.007, 'weight': 3, 'content': [{'end': 480.07, 'text': "And it's the way that it can be enabled or disabled.", 'start': 477.007, 'duration': 3.063}, {'end': 485.738, 'text': "If it's enabled, it's saying like, hey, I want you as a separate server from a different origin to be able to share my resources.", 'start': 480.111, 'duration': 5.627}, {'end': 493.861, 'text': "Now, the thing that's sort of crucial here, if CORS is disabled, it's not that the API is saying, you can't have access to my data.", 'start': 486.358, 'duration': 7.503}, {'end': 497.502, 'text': "It's just requiring that you do it from your own server.", 'start': 494.161, 'duration': 3.341}, {'end': 500.503, 'text': "And this is something that's explained in the Dark Sky API's FAQ.", 'start': 497.922, 'duration': 2.581}, {'end': 504.385, 'text': "If you scroll down, you'll find the question why do I get the error no access control, allow origin?", 'start': 500.543, 'duration': 3.842}], 'summary': 'Cors enables sharing resources with different origin servers; can be enabled or disabled.', 'duration': 27.378, 'max_score': 477.007, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM477007.jpg'}, {'end': 656.398, 'src': 'embed', 'start': 622.745, 'weight': 1, 'content': [{'end': 624.687, 'text': "This is what's known as a proxy server.", 'start': 622.745, 'duration': 1.942}, {'end': 628.572, 'text': "It's basically the server is a proxy for darksky.net.", 'start': 624.707, 'duration': 3.865}, {'end': 636.924, 'text': "I can't make the call to darksky.net directly in the client, so I just send off the latitude and longitude, receive it here, and make that request.", 'start': 628.853, 'duration': 8.071}, {'end': 638.266, 'text': 'Ah, but wait a second.', 'start': 637.184, 'duration': 1.082}, {'end': 643.847, 'text': 'How do I have these variables latitude, longitude? Oh, boy.', 'start': 639.943, 'duration': 3.904}, {'end': 648.21, 'text': 'This is opening up a can of worms about passing parameters with an API.', 'start': 643.867, 'duration': 4.343}, {'end': 650.132, 'text': 'Here I am in the client-side code.', 'start': 648.491, 'duration': 1.641}, {'end': 656.398, 'text': "I want to send to my new weather endpoint the latitude and longitude that I've gotten from the client-side code.", 'start': 650.392, 'duration': 6.006}], 'summary': 'Using a proxy server to send latitude and longitude to weather endpoint.', 'duration': 33.653, 'max_score': 622.745, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM622745.jpg'}], 'start': 170.194, 'title': 'Adding weather functionality to data selfie app', 'summary': 'Introduces the process of adding weather functionality to the data selfie app, including obtaining weather data from the dark sky api, which offers 1,000 free api calls per day and requires authentication through a single api key. it also covers implementing an api call to retrieve weather information by geolocating and using a proxy server to make the api call from the server side in node.js, along with the challenge of passing parameters to the api.', 'chapters': [{'end': 352.013, 'start': 170.194, 'title': 'Adding weather functionality to data selfie app', 'summary': 'Introduces the process of adding weather functionality to the data selfie app, including obtaining weather data from the dark sky api, which offers 1,000 free api calls per day and requires authentication through a single api key.', 'duration': 181.819, 'highlights': ['The chapter introduces the process of adding weather functionality to the Data Selfie app, including obtaining weather data from the Dark Sky API, which offers 1,000 free API calls per day and requires authentication through a single API key.', 'The Dark Sky API provides data in JSON format, has good documentation, and is relatively easy to get up and running with, offering 1,000 free API calls per day for demonstration purposes.', 'The speaker mentions the availability of multiple weather APIs, such as Open Weather Map and the National Weather Service, as potential sources of weather data for the app.', 'The speaker emphasizes the importance of understanding the process of obtaining an API key, making requests, and presenting the data when working with any API, not just the Dark Sky API, and encourages using different weather APIs for learning purposes.', 'The chapter highlights the simplicity of the authentication process for the Dark Sky API, which requires only a single API key, contrasting it with other APIs that may have a more involved authentication process.']}, {'end': 710.387, 'start': 352.213, 'title': 'Using api for weather forecast', 'summary': 'Covers implementing an api call to retrieve weather information by geolocating and using a proxy server to make the api call from the server side in node.js, along with the challenge of passing parameters to the api.', 'duration': 358.174, 'highlights': ['Implementing API call for weather forecast by geolocating and using a proxy server in Node.js. API endpoint url, latitude, longitude', 'Understanding CORS error and the need for a proxy server to make API calls from the server side. Explanation of CORS error, security reasons for API key protection', 'Challenges of passing parameters to an API and the use of hard-coded values for testing. Challenges in passing parameters to the API, use of hard-coded latitude and longitude']}], 'duration': 540.193, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM170194.jpg', 'highlights': ['The chapter introduces the process of adding weather functionality to the Data Selfie app, including obtaining weather data from the Dark Sky API, which offers 1,000 free API calls per day and requires authentication through a single API key.', 'Implementing API call for weather forecast by geolocating and using a proxy server in Node.js. API endpoint url, latitude, longitude', 'The Dark Sky API provides data in JSON format, has good documentation, and is relatively easy to get up and running with, offering 1,000 free API calls per day for demonstration purposes.', 'Understanding CORS error and the need for a proxy server to make API calls from the server side. Explanation of CORS error, security reasons for API key protection', 'The speaker emphasizes the importance of understanding the process of obtaining an API key, making requests, and presenting the data when working with any API, not just the Dark Sky API, and encourages using different weather APIs for learning purposes.']}, {'end': 1059.248, 'segs': [{'end': 813.017, 'src': 'heatmap', 'start': 760.014, 'weight': 0, 'content': [{'end': 765.157, 'text': "If I go to my package.json, I can just see that that's in there now.", 'start': 760.014, 'duration': 5.143}, {'end': 773.182, 'text': 'And then most likely what I need to also do is say const fetch equals require node fetch.', 'start': 765.277, 'duration': 7.905}, {'end': 776.524, 'text': "So that's going to pull the fetch function from node fetch.", 'start': 773.422, 'duration': 3.102}, {'end': 778.685, 'text': 'So I can add that up here at the top.', 'start': 776.904, 'duration': 1.781}, {'end': 780.966, 'text': 'Fetch equals require node fetch.', 'start': 779.185, 'duration': 1.781}, {'end': 783.407, 'text': 'Rerun the server.', 'start': 782.347, 'duration': 1.06}, {'end': 787.23, 'text': 'Give it one more refresh here.', 'start': 784.628, 'duration': 2.602}, {'end': 789.046, 'text': 'And there we go, look at that.', 'start': 788.066, 'duration': 0.98}, {'end': 792.968, 'text': 'I now have the weather from Los Angeles right over there.', 'start': 789.867, 'duration': 3.101}, {'end': 800.471, 'text': 'The last step here, I know this has been a bit of a longer video than usual, but I just want to finish off this one last step.', 'start': 794.189, 'duration': 6.282}, {'end': 807.154, 'text': 'And this last step is sending from the client the latitude and longitude to the server,', 'start': 800.792, 'duration': 6.362}, {'end': 813.017, 'text': 'so that the server can send that latitude and longitude to dark sky, get the weather and then send the weather back to the client.', 'start': 807.154, 'duration': 5.863}], 'summary': 'Added fetch function, displayed los angeles weather, and set up client-server communication.', 'duration': 73.102, 'max_score': 760.014, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM760014.jpg'}, {'end': 882.174, 'src': 'embed', 'start': 854.709, 'weight': 1, 'content': [{'end': 857.511, 'text': 'And that will come in as a user ID parameter.', 'start': 854.709, 'duration': 2.802}, {'end': 861.133, 'text': "So to add that, I'm going to go back to the server.", 'start': 858.091, 'duration': 3.042}, {'end': 872.008, 'text': 'You can remove this hard-coded lat long in and put back in the one that has the latitude and longitude variables.', 'start': 862.523, 'duration': 9.485}, {'end': 875.05, 'text': 'So now I need to add the route parameters.', 'start': 872.529, 'duration': 2.521}, {'end': 879.593, 'text': 'So one thing I could do is I could do slash colon lat slash colon long.', 'start': 875.27, 'duration': 4.323}, {'end': 881.314, 'text': 'So I could have two parameters coming in.', 'start': 879.613, 'duration': 1.701}, {'end': 882.174, 'text': "I don't know.", 'start': 881.894, 'duration': 0.28}], 'summary': 'Update server to use user id parameter and route parameters.', 'duration': 27.465, 'max_score': 854.709, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM854709.jpg'}, {'end': 1016.091, 'src': 'heatmap', 'start': 980.23, 'weight': 4, 'content': [{'end': 982.372, 'text': 'And here I can go back to this.', 'start': 980.23, 'duration': 2.142}, {'end': 986.103, 'text': "Right, because this is exactly what I'm sending in.", 'start': 983.24, 'duration': 2.863}, {'end': 991.268, 'text': "I'm going to the weather route with the parameters latitude comma longitude.", 'start': 986.183, 'duration': 5.085}, {'end': 992.109, 'text': 'All right, I already set that up.', 'start': 991.288, 'duration': 0.821}, {'end': 999.576, 'text': 'Okay, ah! Let me add one more console.log request.params so we can see the raw request params.', 'start': 992.269, 'duration': 7.307}, {'end': 1001.097, 'text': "And let's hope that this works.", 'start': 999.976, 'duration': 1.121}, {'end': 1004.862, 'text': 'You go back to the browser, hit refresh, and there we go.', 'start': 1001.92, 'duration': 2.942}, {'end': 1013.088, 'text': 'I have got the correct latitude and longitude and the weather now from New York, the actual latitude and longitude that I sent to the server.', 'start': 1005.042, 'duration': 8.046}, {'end': 1014.81, 'text': "Let's check the server's logs.", 'start': 1013.449, 'duration': 1.361}, {'end': 1016.091, 'text': 'And you can see, there we go.', 'start': 1015.07, 'duration': 1.021}], 'summary': 'Setting up weather route with latitude and longitude parameters, successfully retrieving weather data for new york.', 'duration': 35.861, 'max_score': 980.23, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM980230.jpg'}], 'start': 710.667, 'title': 'Using fetch api and route parameters in node.js', 'summary': "Discusses the process of using the fetch api in node.js, including installing the node-fetch package, resolving 'fetch is not defined' error, and sending latitude and longitude data to the server for weather retrieval. it also covers the usage of route parameters in handling client requests, demonstrating capturing and processing additional path data for retrieving latitude and longitude information.", 'chapters': [{'end': 813.017, 'start': 710.667, 'title': 'Using fetch api in node.js', 'summary': "Discusses the process of using the fetch api in node.js, including the installation of the node-fetch package, resolving the 'fetch is not defined' error, and sending latitude and longitude data to the server for weather retrieval.", 'duration': 102.35, 'highlights': ["The process of using the fetch API in Node.js involves installing the node-fetch package using 'npm install node-fetch', which then allows the use of the fetch function within the Node environment.", "Resolving the 'fetch is not defined' error involves using 'const fetch = require node-fetch' to pull the fetch function from node-fetch, enabling the retrieval of weather data from the server.", 'Sending latitude and longitude data from the client to the server, which is then used to retrieve weather information from dark sky and send it back to the client, completing the process of utilizing the fetch API in Node.js.']}, {'end': 1059.248, 'start': 813.317, 'title': 'Using route parameters for request handling', 'summary': 'Covers the usage of route parameters in handling client requests, demonstrating how to capture and process additional path data, ultimately successfully retrieving and displaying latitude and longitude information.', 'duration': 245.931, 'highlights': ['Route parameters are used to capture additional parts of the path as variables, allowing for data sent from the client to be processed, enabling more dynamic request handling.', 'Demonstrates the process of using route parameters to capture latitude and longitude data, splitting them into separate variables for further processing, thus ensuring successful retrieval and display of location information.', "Console logs are used for debugging purposes, helping to verify the correct reception and processing of the request parameters, ensuring accurate handling of the client's data."]}], 'duration': 348.581, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/ZtLVbJk7KcM/pics/ZtLVbJk7KcM710667.jpg', 'highlights': ['Sending latitude and longitude data from the client to the server for weather retrieval.', 'Using route parameters to capture latitude and longitude data for dynamic request handling.', "Resolving 'fetch is not defined' error by using 'const fetch = require node-fetch'.", "Installing the node-fetch package using 'npm install node-fetch' to use the fetch function in Node environment.", 'Console logs used for debugging to verify the correct reception and processing of request parameters.']}], 'highlights': ['The chapter introduces the process of adding weather functionality to the Data Selfie app, including obtaining weather data from the Dark Sky API, which offers 1,000 free API calls per day and requires authentication through a single API key.', 'The chapter covers making API requests to external data sources from the server, involving weather information and air quality, and the need to hide API keys for open-source projects.', 'It explores the process of plotting records from the database onto a map, utilizing leaflet.js, and drawing parallels to a previous example involving the International Space Station.', 'Sending latitude and longitude data from the client to the server for weather retrieval.', 'Using route parameters to capture latitude and longitude data for dynamic request handling.', 'Emphasizes the importance of deploying a project onto the web, discussing options for free deployment and considerations for hosting services.', 'Understanding CORS error and the need for a proxy server to make API calls from the server side. Explanation of CORS error, security reasons for API key protection', "Resolving 'fetch is not defined' error by using 'const fetch = require node-fetch'.", "Installing the node-fetch package using 'npm install node-fetch' to use the fetch function in Node environment."]}