Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jun 02 2020 06:16
    @ljharb banned @frank-dspeed
  • Apr 27 2018 01:23
    @MylesBorins banned @fjeddy
  • Feb 24 2016 08:26
    @rvagg banned @jonathanenbe
Lorenzo Sandini
Sorry, very new to this. On my server, I started a project in which the npm package "astronomy-bundle" is installed as a module. Then I wrote a "myapp.js" file importing functions from this bundle, and creating the json file that I need. That's where I am stuck. How can I "require" this myapp.js file/module, to be executed as such ? I Understand I can export its various functions using "module.exports", but can I execute the whole file in one step ?
Jordan Harband
node myapp?
Lorenzo Sandini
I appreciate your help, but isn't node myapp a bash command ? How can I trigger it in an express route ? That's where I am baffled...
Jordan Harband
@lsandini yes, it is. inside a node program, you'd require('./myapp') assuming it module.exports = whatever you want to pull in
Lorenzo Sandini
Aah yes I think I got it now. I modified my myapp.js adding the module.exports = ... and also corrected my "require" stuff in app.js. Now the functions I add in my app.post route are called when a POST request is sent to the server :)
Not still there yet, but progressing. I put the work in progress here https://github.com/lsandini/astro but more corrections are needed
"myapp.js" is called "all-mod.js" in my repo
How can handle big image upload and fetch project with node js optimisation.
Jordan Harband
@lakshmankashyap: i would have answered on irc, but you didn't auth with nickserv.
let me know how can auth
i start a project so I have no idea that what we use to handle heavy files in nodejs
Jordan Harband
find an npm package
but you can't just dive into any tech, including node - you have to learn it first
i have 7 year exprience
in nodejs
let me know what package and structure use
Jordan Harband
… i'm not sure how 7 years of experience would translate to those questions being reasonable. someone with a year or two of experience should know how to answer them (search npm for solutions)
thanks for remind
If I using pm2 on server so is that need workpool implementation on sever for handle high performance api task?
Htc Saj
Hello.How to scrape specific word from different posts on subreddit using puppeteer
Lorenzo Sandini
I see questions and answers here, but very uncommonly the finished product, where the solution has been implemented. So here is my "I did this" entry. And thank you again Jordan for your helpfuls hints : https://astro6.herokuapp.com/
I wrote a little API to which you can POST a date, and it will return the heliocentric coordinates of planets, using the excellent "astronomy-bundle" npm package
The HTML interface is not what it's all about, I plan to send POST requests from another node app and retrieve the sama data in JSON format, like this https://github.com/lsandini/astro/blob/main/ask-api.js
I am trying to reuse
const queryParam = (error, result) => {
  if (error) throw error;
1 reply
in customerController.js, like this
exports.get_all_customers = (req, res) => {
  const FETCH_CUSTOMERS = "SELECT * FROM Customers";
  db.query(FETCH_CUSTOMERS, queryParam);

exports.get_customer = (req, res) => {
  const GET_CUSTOMER_BY_ID = `SELECT * FROM Customers WHERE id = ${req.params.id}`;
  db.query(GET_CUSTOMER_BY_ID, queryParam);
4 replies
but I get an error - ReferenceError: res is not defined
I tried to rename resinto result
but then - TypeError: result.status is not a function
Hi everyone, I deployed an express app with aws cognito for authentication but when I tried accessing it after deployment on ecs it doesnt work. What might be the issue
1 reply
What are the best practices to wait for a blockchain number of confirmations and execute an operation in firebase via api? I'm working on a web3 application with a node.js server, I imagine doing this on the client side would be very bad as it would be waiting with the browser locked, but at the same time it seems costly on the server side, for how long it will be waiting for confirmations from several customers. I thought the node.js server would stack the requests in a queue [(hash,blockNumber), (hash,blockNumber)...] and until the queue is clear check for every update in the block, if it can be executed. would there be any better way?
2 replies
No sense in blocking approved stuff with non-approved stuff blocking the way
Jordan Cech
Anyone ever have issues using child_process in an Electron app when packaged for Windows?
Duc Nguyen
Can I downgrate node from 13x to 10x?

What would be the most appropriate way to create a withdrawal system? The user having virtual currencies (firebase) and exchanging them for ERC20 tokens?

The user makes a request to api and when I receive the request on the node.js server I have to approve first then transfer? should I do it in a contract or a wallet? Is there a way to make these transactions safe and automatic?

Hi all, I have a requirement to send email to # number of users at particular time the user sets in the application. Consider 100 users using my web application, each user sets their preferred timing to receive emails to their inbox. Now I will have 100 different timestamps every day to send email. How we could solve this problem?. Using node js backend.
Stephen James
Sort them by soonest to expire, then you only have to deal with the one that is next to expire.
Jordan Harband
use sendgrid or similar
unless email's your core business, do not waste time or money trying to build something yourself
Create MERN App

Hello Everyone,

MERN Micro Framework provides starter kits for building web, desktop and mobile apps in pure JavaScript.


If you have any query or suggestions. Please let me know.

Jordan Harband
that's a very brazen name to take for a framework, since it's an established initialism
Hi. I am a fronted dev. Looking for a backend dev to work with me on brainstorming a startup idea. Kindly get in touch with me if you are interested.
1 reply
Discord : Chaitanya#9783
Hello @Chaitanya7666, sound interesting your idea
Can we discuss about that
Seif Eddine Slimene
Hello guys,
I have a form where some users can enter up to three emails to invite friends to the website.
I have a technical question, how can I prevent someone from somehow using malicious code to send thousands of emails (instead of up to three).
PS: this website is built with React.js.
Hi, is there any way to view a package that has been removed due to audit? I want to verify the audited files contents. Package is here https://www.npmjs.com/package/uniswap_connect
Jordan Harband
no, unless you find an old copy of it somewhere