Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
so what doesn't work with what your doing?
Oh your trying to make an http request to another function
you need to call it using fetch as if your calling it from the front-end. Or seperate out the logic in the getActiveCateogires to an actual function and cal it like your last example
but that only works if the server knows what function your talking about
import fetch from 'node-fetch';
const {API_TOKEN} = process.env;

exports.handler = async (event,context,callback) => {

    const activeCategoriesRes = await fetch('https://api.example.com/category/GetActiveCategories',{
        method: 'GET',
        headers: {'APIToken': API_TOKEN}
    const activeCategoriesData = await activeCategoriesRes.json();
    const categories = activeCategoriesData.result;
    const categoriesIdArray = categories.map(category => category.CategoryId);
    const productsNested = await Promise.all(categoriesIdArray.map(categoryID => {
        const categoryProductsRes = await fetch(`http://api.example.com/Product/GetProductSearchByCategory`,{
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'APIToken': API_TOKEN
        body: JSON.stringify({
            "CategoryID": CategoryID,
            "Search": " ",
            "lstBrand": [],
            "lstColor": [],
            "lstSize": [],
            "PriceFrom": 0,
            "PriceTo": 0,
            "MaxPrice": 0,
            "Page": 1,
            "Show": 9999,
            "UserID": ""
    const categoryProductsData = await categoryProductsRes.json();
    return categoryProductsData.result;
    const productsList =  productsNested.flat();
    const hotDeals = productsList.filter(product => product.DiscountPercentage > 15 && product.SellingPrice > 50);

        statusCode: 200,
        body: JSON.stringify(hotDeals)
since i have separate lambdas that already do getActiveCategories and getSearchResults, this seems like duplication of code
You can share the code if you put the logic into a common function outside of the files. You will end up needing a build system tho
otherwise you will have to call the function using fetch correctly
I'd recommend reading into both approaches. The sharing code approach is more complex in terms of setting up, but will be more performant and scalable for development
@bradtaniguchi sorry I'm not knowledgeable enough to understand the approaches you are referring to, could you send me link or something that i can read which describes the approaches you mentioned
@siliconchild So first of all, I point out stuff for you to go out and research yourself. Googling something as simple as "how to have multiple functions for a cloud function" is a good start. The other approach using fetch could be looked into as "how to use fetch in nodejs"
I don't suggest believing you need any more guidance than that most of the time. If you don't know what concepts i'm talking about then it sounds like its time to first figure out what I'm talking about (by getting more familiar in any way possible) and then learn how you can apply it in your own project
Same goes for your errors. I'm sure you will figure it out after some time, but don't expect to be able to run code, figure stuff out without trouble, that isn't the point. The point is being presented a problem and being able to figure it out over time. Google your way out of your error, bash your head against the code, and learn through trial error and understanding. That is how you get experience

that it periodically fetches data from the original server, say once every 2 hours and then caches it

The netlify server instance shouldn't stay running longer than a few seconds, or minutes after each call between calls. Thus you will need something running "long term" if you want to cache it for 2 hours

Hello Fellow Campers. I am looking for FE Campers to join a project on which I am working on. I recently participated in a hackathon and WON in it. Now I am being requested to develop it further and superfast. Will be glad to get any of the Fellow Campers to test out the skills that we have acquired through FCC onto a real life product. Here is a link to the blog post mentioning about my team wining the hackathon https://blog.kyber.network/kyberdefi-hackathon-meet-the-winners-bea5bc9ec983 . Drop me a dm if you would like to come work on this.
Govind Rathi
Hey did anyone here try Upskill Robeen Dey course here?
Doni Yafi
Anybody knows how I can solve this issue?
er... whats the issue?
Doni Yafi
On smaller devices, the container of the select options pops out of the screen
Is there anyone here's for help?
Sakis bal
@vaggar12 Ask your question and someone will answer if they can
Govind Rathi
hey there!
Will you please tell me what's the wrong with the page, why my js is not adding anything into my page. Here is the link https://jsbin.com/noxulotuna/edit?html,js,output
I have corrected the li element name mistake, but still doesnt work on my machine.
Corey Lewis
let tobeAdded = `<div> <p>I am paragraph 1st.</p> <p>I am paragraph 2nd.</p> </div>`; ul.insertAdjacentElement("beforebegin", tobeAdded);
tobeAdded is a string not element, that's probably causing a problem, haven't dug deep into it though
Govind Rathi
Thanks @cursiv3 , will look into this
Abraham Anak Agung
@Kingpin23 you can use insertAdjacentHTML for string contain html markup.
Doni Yafi
Hi guys, I’m having a problem with fixed navbar’s anchor tags linking to local IDs. The scroll jumps further into the sections, since the top of the page is hidden by the fixed navbar. I tried setting the ‘top’ of the body to push it downwards but with no success. I appreciate any input from you.
Stephen James
@yafiwebdev - looks like this article talks specifically about your problem.
Tunde Oretade
hi guys I need help with a battleship project. It's quite large and I need advise on how to share it on this platform. can someone help?
Govind Rathi
I am watching a project on youtube that involves this line <i class="lorem ipsum" job="delete" id="lorem">
what is this job attribute I have never heard of something
Abraham Anak Agung
@Kingpin23 I never heard that one too. The way using custom attributes is by using data-*attribute.
Do Hoang
hello, i just finished my first challenger about tribute page, can you guy give me some recommends
and should we use boostrap or some UI framework to do these challenger?
Abraham Anak Agung
@huyhoang8398 very nice :thumbsup: . My input for you is:
  1. I see you use id for styling, usually, we use class, since the class can be used by many elements. Not saying that you can't do this with id, but id is unique.
  2. for the border you can use short border notation, so like border: 1px solid black.
Do Hoang
@padunk great, thank you so much for your recommendations
Doni Yafi
@sjames1958gm Thanks! I'll check it out
Hi , I am struggling to understand why mouseover or click does not work on a nested element , but instead it the event happens on a far parent/grandparent element. BTW this happens only on IE11 . Chrome works fine.
here is the html:
<button type="button" class="a-button-nostyle m-country-select"> <img class="a-image icon-flag"> <span>Germany</span> <div data-component="MDropdownFilter" class="m-dropdown-filter country-dropdown has-error is-open" data-component-id="jjj534jk34j5"> <input placeholder="Germany" class="a-input filter" type="text" required=""> <ul> <li class="ul-container"> <ul class="options"> <li class="a-option" aria-selected="true"> <a href="/content/p11/page.countryselector.de_DE.de_de.EUR.jsp?goeorguri=%2Fde_de%2Findex.htmltarget="_self" class="a-link is-multilanguage internal-link">German</a> </li> <li class="a-option"> <a href="/content/page.countryselector.en_DE.en_de.EUR.jsp?goeorguri=%2Fde_de%2Findex.html%3FdebugClientLibs%3Dtrue" target="_self" class="a-link is-multilanguage internal-link">English</a> </li> </ul> </li> </ul> </div> </button>
i am hovering over ul-container or a-option etc. but it shows the hover on the root button element
Jim Montgomery
is there a proposal/rfp/rfc (including deprecated one) for javascript module bare imports? like import 'React' and similar? I cannot find anything in my searching of github/tc39 and more general searches. Thanks. Found https://gist.github.com/jkrems/769a8cd8806f7f57903b641c74b5f08a#Future
Hello guys, Could anyone please review my Survey Form front-end projects. Your help would be appreciated.
Mohammed Boudad
@kksrini89 it looks good, except that it says (at the very bottom of the page) "#mocha div missing, add it to your document" when you run tests.
Kris Baillargeon
Hey guys. Been a while :^)

Hello. I am trying to use flex box. I have set display Flex to my nav section. I am then trying to justify-content: flex-end to my button, however it doesn't seem to be working.


If anyone can tell me what I have wrong, would appreciate it. Its very basic code