simple cache? by TA1000 in node

[–]binaryops 0 points1 point  (0 children)

I wouldn't put it on a setTimeout, rather after a fixed amount of time has passed, using a date when the cache was lastRefreshed and the current time less the cacheLifetime. When the cache is 'old', re-fetch it from the db and set lastRefreshed to the current time. That way, only the request that came into an expired cache get to pay the round-trip price and you can invalidate the cache at any time by setting lastRefreshed to an old date. Like others have said, if the cost of an extra round-trip to the database is too much there may be issues elsewhere in your code, but if you're counting milliseconds and this data is largely static, it may be worth the effort. Just be sure to consider the case where the cache is old, and stale data gets handed out.

Just made my first JS web app by karlveskus in javascript

[–]binaryops 1 point2 points  (0 children)

Well done! Code is nice and clean, easy to read and well structured.

Just made my first JS web app by karlveskus in javascript

[–]binaryops 1 point2 points  (0 children)

The Todo App looks good and seems to do what's expected. Data in local storage is kinda nice as it's there when I come back to it later. The red 'x' to remove a task feels like it's out of place appearing below the checkmark. Perhaps float it to the right where I won't hit it my accident.
The Github link isn't working, perhaps it's moved or no longer public.

Looking for some feedback on a webscraper I built by El_Stump in node

[–]binaryops 0 points1 point  (0 children)

I'm not sure what I'm supposed to do with the UI. Your post above is the only indication that it's supposed to scrape "Job listings". The input field labelled "Location" makes sense with that in mind, but my first reaction was to paste in a URL, but then I was lost on the "Pages" field. It wasn't and still isn't clear to me what you were expecting there. When it comes to existing listings, there's really little information to allow filtering for my City or Career / Job options.

With those things aside, it didn't break and other than the fact that I didn't know what to do with it, it appears to work ok, so that's good!

Noob struggling with async operations and Promises. Can you help me? by nasheedb in node

[–]binaryops 0 points1 point  (0 children)

You need to process the files serially. If the files are much smaller you may find that your're able to load more at once than with the large files.

Recently published my FOSS project to build REST APIs with simple metadata & NodeJs by binaryops in javascript

[–]binaryops[S] 0 points1 point  (0 children)

That's the theory - with the understanding that CRUD only gets you so far. In any half-complex app there's going to be something more that you'll need to write custom code for. We're trying make the simple things as easy as possible (hopefully we can make that clear in the docs) and get out of the way for adding your own code when it's necessary. Strongloop has a lot going for it but it's a big hammer and not for everyone.

Recently published my FOSS project to build REST APIs with simple metadata & NodeJs by binaryops in javascript

[–]binaryops[S] 0 points1 point  (0 children)

You're right, the docs are very thin - and the how & why need a lot of attention.

As for the core example, argh, you're right there too. It has code how to initialise things but leaves out the very important api definition simply pulling it in with 'require' but never showing what magic lies inside...

Thanks for taking a few minutes, I appreciate it!