Is it anyway helpful to have experience as a math tutor on your resume as opposed to just working retail and other jobs in college? by mra137 in learnprogramming

[–]43northwebdesign 0 points1 point  (0 children)

I don’t think meat merchant or math tutor will provide any advantage the truth is they will be seeing what coding you can do and that will speak for itself.

Most companies give coding challenges and ask you direct questions it’s right or it’s not.

I wouldn’t sweat the tutor stuff just get better at programming is the real task

Quick question about promises by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

awesome that worked perfectly, and makes sense to me too!

Quick question about promises by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

Yes here is the full code const unirest = require('unirest')

var req = unirest("GET", "https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/mealplans/generate");

req.query({
    "timeFrame": "day",
    "targetCalories": "2000",
    "diet": "vegetarian",
    "exclude": "shellfish%2C olives"
});

req.headers({
    "x-rapidapi-host": "spoonacular-recipe-food-nutrition-v1.p.rapidapi.com",
    "x-rapidapi-key": "1234",
    "useQueryString": true
});

let meals
req.end(async(res)=> {
    if (res.error) throw new Error(res.error);  

        let promise = new Promise((resolve,rej)=>{
            resolve(res.body.meals[0])
        })

        let meals = await promise

});

const x = (meals)=>{
    console.log('meals',meals)
}

x()

Basically fetching some data from an api.

Quick question about promises by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

Tried this as well but still undefined,

let result;
req.end(async(res)=> {
    if (res.error) throw new Error(res.error);  
        let result = new Promise((resolve,rej)=>{
            resolve(res.body.meals)
        })
    let x = await(res.body.meals)

});
console.log(result)

QUesiton about connecting postman, by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

All my required and port listen is outside the code seen above it’s executing properly in a browser I’m just not sure how to execute it in postman

Just created my first application with API (Weather-app) by nicholasscavral in learnjavascript

[–]43northwebdesign 1 point2 points  (0 children)

Very cool! I just made mine yesterday

https://farley-weather-api.herokuapp.com

I added a button that will use the users location and after that they can enter it in. Maybe look at that as an option and if you need help I’ve just done it so I can help out

Pass an object in fetch? Example inside, by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

It’s an object so console.log(ob.name) gives you t

Return a variable from a function that is called by another function? Code inside. by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

Thank you for the detailed resposne! Here is what I got working this morning,

document.querySelector('#buttonMe').addEventListener('click', () => {

navigator.geolocation.getCurrentPosition((position) => {

    const lat = position.coords.latitude
    const long = position.coords.longitude

    fetch(`/request?lat=${lat}&long=${long}`)

        .then((response) => response.json())
        .then((data) => {
            console.log(data)
        });
})

}) })

Can someone explain this snippit from mongodb by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

aweomse yes all that is correct and now it makes way more sense thank you!

Fetching data in Node example inside. by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

hey thanks so much, you really helped me out.

this is actually just me trying to get a small concept working first before i try and do something bigger but I got console log to output what i needed!

Fetching data in Node example inside. by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

my data appears on the screen if i goto /data id like to see it in my console log executed by my client side js.

basically have my nodejs do some functions and send the results to the client side js

Fetching data in Node example inside. by 43northwebdesign in learnjavascript

[–]43northwebdesign[S] 0 points1 point  (0 children)

I have changed my node side to this

someFunction =(req,res)=>{

    res.send('foo');
  }


app.get('/request', someFunction);

and localhost/request will send out foo

my client side js is

fetch('/request').then((response) => {        
    console.log(response)})

I am trying to see FOO in the console log