Three Years later and i can't find a better vid than this for resolving cors.Thank you for the beginner friendly and clear explanations.
@kaxbyrita92792 жыл бұрын
I’ve watched through the Coding Train videos for about a year now, and i’m still amazed that this quality stuff is just out there for everyone to enjoy for free. So huge thanks.
@Sondly2 жыл бұрын
Just wanted to say thanks for this video. I was struggling with properly using a 3rd party API. Most tutorials on KZbin show how to use 3rd party APIs but not on how to setup a route so the user/client doesn't have access to your key! This was super valuable, in ANY REAL WORLD APPLICATION, you don't want the user to have access to that key! They could run up your bill etc! Thank you for the video.
@alpachino4683 жыл бұрын
I don't think I've ever seen a more cheerful, bubbly, coder before... I'm usually banging my head in pure frustration whenever I have to explain anything code-related to anyone, especially my bosses...
@Bradenxd124 жыл бұрын
This was exactly the explanation I was looking for when it comes to CORS. It has been quite a confusing topic for me until now, excellent video!
@stevenrivadeneira9903 жыл бұрын
This is an amazing series. A note regarding node-fetch as of 09/18/21: When I ran "npm install node-fetch", it gave me an error because node-fetch got upgraded to v3 and was wanting me to use "import" instead of "require". Make sure you update your .json to run node-fetch to version 2.0.0 if you see the same issue, and then it will work! Just paying it forward =) Thank you so much for these videos!!!
@mahmoudalsayed30413 жыл бұрын
you are a legend :D
@aislayer28663 жыл бұрын
thanks sooooooooooooooooooooooooooooooooooooo much
@averagegodotenjoyer3 жыл бұрын
Saved the day. Thanks.
@Roudrix1182302 жыл бұрын
Thank you very much, my dude
@dokidoki4082 жыл бұрын
Man I should have read the comment section first I, lol. I also found a solution from stackoverflow on how to solve this problem, were you first uninstall fetch-node ("npm uninstall node-fetch") than install fetch-node v2 ("npm install node-fetch@2").
@oxygenmoldova2 жыл бұрын
Man you are a treasure, thank you for your effort and all of the content that helped thousands of people to become better devs and struggle less with reading answers on stackoverflow
@kardes85282 жыл бұрын
I want to say thanks for this and all other videos that you make. You make my days with whole those videos and the energy that you give us. You are the one of the bests who has all the attraction during the video with covering whole knowledge. Thank you Daniel with all my heart :)
@leerenae3133 жыл бұрын
Amazing this is such a great reference, short, concise and straight to the point! You're an amazing teacher thankx for putting this up for free ☺
@lexNwimue2 жыл бұрын
Just seeing this channel for the first time (I wonder how it's possible that it took so long) and I already like how you explain things.
@alex755213 жыл бұрын
I'm working on a personal project to develop some web dev skills and this video just helped me immensely with a problem that i've been struggling with the last couple of days. Thank you!
@destinationveritas4065 жыл бұрын
Loving your video series on this topic so far. These videos have answered some questions I've had for a few days now that I haven't seen covered, or at least not in a clear manner, in other tutorials here on KZbin or even on Udemy. Keep up the fantastic work! Looking forward to watching more of your content.
@devilnight66105 жыл бұрын
Let's share this video to your friends who have the same passion! People : The Coding Train is Quality Contents KZbinr? Me : Yes.
@danfeinstein44242 жыл бұрын
"Dark Sky might change a little by the time you do this..." "Dark Sky is closing its API in 2023 and is no longer accepting new signups" lol
@aliaksandrhn12 жыл бұрын
You make great videos and manage to do it in a fun way. Your personality is endearing. Thank you.
@alexsandergutierrezgoncalves5 жыл бұрын
very cool these classes, it is difficult to find classes in Portuguese with a level of content well explained, so I watch English with subtitles kk
@heavygruff4 жыл бұрын
6 days left until I finish the requirements of my bachelors in software engineering and this refresher has been clearer than any of my instructors have been able to explain anything. Thank you. Happily hitting that subscribe button.
@piotrkalman15623 жыл бұрын
You are a magician. I've been looking for a solution for a week. Thank you so much :)
@godetarnaud10054 жыл бұрын
You guessed it right at the beginning of the video (well around 5min) dark sky api isn't an option anymore (it got brought by Apple and stopped allowing new sign ups) so I'll follow along using Open wheater api (it seems to be pretty similar and also ask to create an account) I'll comment again if it's a success and share the code on github if others are interested :D (btw this video series is awesome ! I really enjoyed going until there ^^)
@BrianKiddDevDesign2 жыл бұрын
Did it work using Open weather api?
@geoffwagner4935 Жыл бұрын
wow those rover cameras are amazingly clear
@jamesharrington23854 жыл бұрын
I really love this teaching format with the presentation style.
@lilrex20155 жыл бұрын
Still awesome, loving this video series. I vote for an OAUTH2 series at some point.
@sanchitverma28925 жыл бұрын
vote
@pablovm5785 жыл бұрын
Thanks to his advice i was able to do this from scratch play.google.com/store/apps/details?id=com.supercalamar.spaceout
@personzen80282 жыл бұрын
old but gold, thank you
@heksqer10225 жыл бұрын
Love your way of teaching ! Looking forward to this series.
@kreddy2414 жыл бұрын
You are the best - I've learned so much from you. Appreciate your vids!
@JustinSulak4 жыл бұрын
"The risk here is the Dark Sky API may not exist anymore...". *Foreshadowing*
@atharvparlikar87653 жыл бұрын
these fucking bots
@swiftpotato67465 жыл бұрын
So I was trying to get data from an API and kept getting the CORS error. I was fetching from the client side but then I clicked and remebered this video! Thanks man :D
@matteol13563 жыл бұрын
Dark Sky doesnt work anymore, I tried using another API from another web site called "open weather" and it works just fine, it also has an easy to read documentation!
@Ketrixx Жыл бұрын
04:30 - and the risk comes true, Dark Sky API doesn't exist anymore it was replaced by WeatherKit REST API
@annahri5 жыл бұрын
I hope there's someone like you (or you!) to have series on .NET CORE!
@vasyaqwe20872 жыл бұрын
This helped so much! You're amazing!
@mkhalidumer5 жыл бұрын
Hi Daniel, thanks for being here always :) You have got a unique style of explaining, really appreciate your effort and time you put to create these tutorials :) may I ask a question, ? why node-fetch, why not request ?
@andrewwee84503 жыл бұрын
"This is my API key" -> famous last words
@vvill-ga4 жыл бұрын
If you are here for the tutorial to learn how to access an api with node.js the video starts at 5:00...
@SimonTiger5 жыл бұрын
0:52 That's also true in the original Data Selfie App project!
@SimonTiger5 жыл бұрын
So I don't know why you've done that in this project, but not in the Data Selfie one.
@punjabitech55464 жыл бұрын
Thank You. Your channel is awesome
@yourteacher43535 жыл бұрын
Thank you, Daniel. Top notch as always.
@prabhatsingh77134 жыл бұрын
You are genius brother....!!
@m5amisi8963 жыл бұрын
wow, I love you man. you saved me.
@anubislockward37503 жыл бұрын
Just so you know...the Dark Sky API is no longer accepting new subscriptions.
@theodoredwernicki57292 жыл бұрын
Would you recommend any other weather api ?
@Pdrum28 ай бұрын
@@theodoredwernicki5729I would use national weather service
@harjotsingh86712 жыл бұрын
I love this guy.
@andylib4 жыл бұрын
While watching (end of March 2020, during Corona) I just got the notification that apple acquired Dark Sky and will be shutting down these services: - the iOS app will be continued, website and android app will be shut down at the beginning of July 2020 - the API will be available until the end of 2021 .. what a bummer
@jamesjassi374 жыл бұрын
could you please tell me how to find similar api ?
@BenjaminCarlson4 жыл бұрын
@@jamesjassi37 Here's a similar one I found that I'm going to be using to build the same thing but in flutter! www.climacell.co/weather-api/
@snacksy77544 жыл бұрын
This one is not as easy to use but run by a Norwegian government institution so will probably not disappear any time soon URL: api.met.no/weatherapi/locationforecast/2.0/compact? PARAMATERS: lat=60.10&lon=9.58 Tempature at: response.properties.timeseries[0].data.instant.details.air_tempature So yeah not as easy to use 😅
@fcs_965 жыл бұрын
Nice lesson. Thanks
@ItsANoBrainer5 жыл бұрын
You should do a video in this series that utilizes Websockets using the WS javascript library! I think it would fit very well with the server theme.
@omars.1625 жыл бұрын
Awesome video! Quick question, what is your terminal setup?
@TheCodingTrain5 жыл бұрын
This workflow video series might help! kzbin.info/aero/PLRqwX-V7Uu6Zu_uqEA6NqhLzKLACwU74X
@PauloMiello3 жыл бұрын
Thank you!!
@Programmerprith3 жыл бұрын
Sir can you please suggest any other api like dark sky
@jonathan-._.-5 жыл бұрын
In this case query params would probably be the preferred choice as you have 2 variables with the same 'importance' - for path paramers im usually expecting a sort of inheritance structure like weather/:country/:state/:city where each path paremeter is a subset of the one before
@yulinglin85083 жыл бұрын
Save my life! Thanks a lot!!!
@c8105495 жыл бұрын
Hi , thank you so much for the great video. I’m also interested in learning „URL query string“, can you please point me out which video from you I could watch ? Thanks again for the amazing video.
@ViswasHaridas5 жыл бұрын
Hey, you might be looking for 'Template literals', which is a feature introduced in ES6. Basically, you use backticks ( ` ) instead of quotes ( " ) to enclose your string, and you can put any js expression inside these: ${} Here's an example: const name = 'Chun'; const mood = 'happy' console.log(`I'm ${name} and I feel ${mood}!`); // I'm Chun and I feel happy! Docs: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
@joe_3y3s5 жыл бұрын
Could you do some of these vids with testing? There is such a lack of test driven tutorial vids out there!
@TheUnown42 жыл бұрын
does post and get really matter if you can get data via post response or post data via get request?
@getorvillized74995 жыл бұрын
At the beginning of the video, it sounded like you were going to cover different hosting options. When are you going to go over that part? :)
@TheCodingTrain5 жыл бұрын
Check the full playlist, it's the last one! kzbin.info/aero/PLRqwX-V7Uu6YxDKpFzf_2D84p0cyk4T7X
@getorvillized74995 жыл бұрын
@@TheCodingTrain Ok, thanks.
@אביחימסלאווי4 жыл бұрын
Hi .. I build a server api one my local computer that only says hello . It works with request from postman an it works with request the from the browser ..but it doesn't work from a fetch call its show the same CROD error what to do .
@hayderjabur62584 жыл бұрын
so what is the best way to make a request from client side or server side ?
@Arisekiwi5 жыл бұрын
Hi Daniel, I am running into problems with the geo location. I can successfully run the "data selfie app" in Chrome and Firefox but it is not geo locating at all. And there are no errors in the console or in google developer tools. The app works for taking images and storing the data in the db but no location data... Weird. Have you had any problems? This issue also occurs in module3. Kind Regards.
@TheCodingTrain5 жыл бұрын
hmmm, maybe you have some security settings on your computer that block the browser from geolocating?
@Arisekiwi5 жыл бұрын
@@TheCodingTrain I thought about that, So I modified the settings in my browser to no avail. My next point of call is another laptop. Good news is though the image saving and comment check in side are working perfectly.
@kureysalp5 жыл бұрын
Tahnks for this video series they are awesom but I have a problem. When I typed ${variable} for parameters code takes it as a text its color not turning to blue. What is wrong in here?
@kureysalp5 жыл бұрын
I passed parameters with putting + between text and variable bur I wonder why ${} didn't work for me
@davidchen44954 жыл бұрын
Late reply but it’s back quote not single quote
@nvurt3 жыл бұрын
@@davidchen4495 Thanks for adding this.
@yuriihusak19595 жыл бұрын
Hi! I love what you are doing, thanks! I was wondering why don't you use the advanced destructing ES6 feature for variables assignment, like: const { lanlon } = request.params; const [ lat, lon ] = lanlon.split(","); Mostly, it is shorter... But in spite of that your channel is still the most interesting on youtube
@TheCodingTrain5 жыл бұрын
Thanks for the tips!
@gokselkucuksahin3 жыл бұрын
15:30 Or, we could use array destructuring; const [lat, lon] = request.params.latlon.split(',');
@NIronwolf3 жыл бұрын
I'm thinking why bother to split it at all? Just pass in ${latlon} to the URL literal. A bunch of code to parse it then reassemble it exactly as it was.
@jonathan-._.-5 жыл бұрын
I wonder if thers a procy pass endpoint for node ?
@mythic1265 жыл бұрын
Gave me an idea.
@clementvanhecke28325 жыл бұрын
Checkout Netatmo's weathermap, very similar !
@ujjavalsinghvlog75455 жыл бұрын
woah we can save check ins to session or local storage instead database :O
@gabrielfono8442 жыл бұрын
I am not sure why I can't see the src folder
@gabrielfono8442 жыл бұрын
sorry mistake I solved my issues since I come from java background , I was little bit confused thanks your tutorials are amazing
@bpc10264 жыл бұрын
Darksky does still exist in the same manner..... although it appears Apple just bought them and they have closed signups and the API will not be available starting 2022 :/
@kaizen94515 жыл бұрын
When's your 3rd book, Daniel? :P
@daybreak_eats3 жыл бұрын
Can someone help me understand why the request from the browser received the CORS error, but not from the server, which I presume was requested from the same public IP (origin) as the client? Or is that mentioned in an earlier video?
@RupertBruce2 жыл бұрын
The server has its IP address and can be set up to hold the API key securely as explained in the video. The client is on the user's machine which has its own IP address and the browser restricts what the javascript has access to. You are in control of the server and you have the key. The user is in control of the client so it is not safe to send your key, just the data that the server acquires using your key.
@zicada76615 жыл бұрын
Why don't darksky offer a POST endpoint i wonder. Seems easier to send lat and lon in the request-body instead of having to combine and then split the two parameters in the url.
@mart33235 жыл бұрын
there's a bunch of rules called the 'REST principles' that guide what the URL should look like and which verb (GET vs POST vs ...) you should use for each request Most API's try to follow that because existing tools take advantage of those semantics (for example browsers will warn you if you try to refresh a page opened with a POST request, telling you that it will resend the request and it might cause something to happen twice) The effort of having to split/join two numbers and put them in the right place is trivial enough that it's not even a consideration
@anibelle284 жыл бұрын
Unfortunately, in June 2020 the Dark Sky API is not accepting any new sign-ups :(
@johncerpa37825 жыл бұрын
Awesome
@asturnebur5 жыл бұрын
is this video upload again?
@yashchaudhary35443 жыл бұрын
We can send lat and long from client to server via request parameters while making the get request. Someone correct me if I am wrong
@Varshakumari-uz8uo3 жыл бұрын
Your teaching style is fabulous. But when I am writting same code to call third party API I am getting error.
@bacho74105 жыл бұрын
How can I send something from server to client without client requesting it?
@stabgan5 жыл бұрын
you need ro ask permission and also the client may need to be subscribed to webhooks
@TheCodingTrain5 жыл бұрын
You could also investigate websockets
@someoneoutthere18664 жыл бұрын
Apple discontinuing API since they bought DarkSky
@praful7285 жыл бұрын
Can you take session on npm Mqtt.
@DayV_5 жыл бұрын
Video on npm: kzbin.info/www/bejne/qWiTXompqslsjM0
@magdalenaduma16604 жыл бұрын
Hi i try use different ApI from openweathermap.org/, ale path looks like this: `api.openweathermap.org/data/2.5/weather?appid=MY_KEY&lat=${lat}&lon=${long}`, how can i route parameters from this path without "/"? in express we have a hint, but i dont know how: Route path: /users/:userId/books/:bookId Request URL: localhost:3000/users/34/books/8989 req.params: { "userId": "34", "bookId": "8989" } Please help me, where am I must looking for answer? :)
@darkceptor445 жыл бұрын
Why do you use const so much, isn't it best practice to use var for variables that you're not gonna use outside of the functions?
@jochenpanjaer9805 жыл бұрын
Best practise is to use const and let.
@lilrex20155 жыл бұрын
var gives you global scope access and as such, you can screw with the assignment which can cause problems. Let is local scoped, and Const prevents reassignment. it is better to use Const.
@darkceptor445 жыл бұрын
@@lilrex2015 I thought var was actually local scope not global, anyway const will cause an error and interrupt the entire thing if it's null, I think using var and manually checking would be safer because you could make it run anyway and account for the error.
@lilrex20155 жыл бұрын
@@darkceptor44 if the information if going to be dynamic whether that be from user input or just data manipulation you would ideally use Let over var, CONST is used when you know exactly what's coming in and want a permanent setting. So in a fetch, the URL for the destination server should normally be a const.
@jochenpanjaer9805 жыл бұрын
@@darkceptor44 if const turns out to be null, it is null for a good reason. you can then check for null of falsy data and handle it appropriately. data flow and documentation is important. without writing actual documentation, const gives you already a good insight that the data will not change. I use const about 10 times more often than let. And I (and my team) never use var.
@ivansakal12245 жыл бұрын
Are we gonna see some Python content anytime soon?
@geoffwagner4935 Жыл бұрын
The mot important take away here , is the "cors", i really thought node.js just had a better fetch, turn out it' because it's a server not a client
@kjyhh5 жыл бұрын
Very basic technic of a client request and response to server and to another server. #nodejs
@geoffwagner4935 Жыл бұрын
i''ve done so many fetch i'm not even sure why i tried node-fetch lol
@Nola1222Piano5 жыл бұрын
Cool video, love the concept! PS, could you please take a look in your email 🙃, would love to have the slack invite! 😉😊
@TheCodingTrain5 жыл бұрын
look for members only post on the community tab with a link to a google form!
@Nola1222Piano5 жыл бұрын
@@TheCodingTrain Thanks! Filled it in!
@Mmustafa-v4j4 жыл бұрын
Noooooo Dark sky is no longer accepting new registrations.
@bluedragonn14 жыл бұрын
I create my DarkWeather API 3 days before Apple boughts it
@geoffwagner4935 Жыл бұрын
More important 2023 than dark sky(meh it is important i did want to know who apple's api was), node.js has a convenient fetch now since one i in e6 and express is not. the fetch-node npm just become incredibly inconvenient now.
@kevinnjoroge82364 жыл бұрын
Dark Sky are no longer accepting new signups! daaaam!
@3litepker4 жыл бұрын
Ah Americans lonjitude...
@akhileshpips5 жыл бұрын
this guy must be so iritating in real lifee
@matthewsmith15713 жыл бұрын
yeah i know right? Imagine someone being passionate about something!? You must be a joy to hangout with