p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Promisify all mongoose queries using async/await

Open catarak opened this issue 7 years ago • 17 comments

Nature of issue?

  • [X] Existing feature enhancement

Feature enhancement details:

Right now, all of the mongoose queries use callbacks instead of the new ES6 promise syntax. This should be updated as nested callbacks are difficult to read.

catarak avatar Feb 07 '18 20:02 catarak

I'm on it.

dhruvdutt avatar Feb 07 '18 20:02 dhruvdutt

@dhruvdutt still on it?

himanshuc3 avatar Feb 19 '18 14:02 himanshuc3

Yeah. I've already started with it. Will be pushing by this week.

dhruvdutt avatar Feb 19 '18 20:02 dhruvdutt

is anyone assigned to this issue?

migom6 avatar Mar 20 '18 17:03 migom6

@dhruvdutt started working on it but i don't know how far they got. feel free to start on this!

catarak avatar Mar 20 '18 17:03 catarak

it might be helpful to work on this in pieces, like promisify one controller at a time or something.

catarak avatar Mar 20 '18 17:03 catarak

Ah! I'm sorry, couldn't get back to this. I would be happy to review a PR. Best of luck @migom6 :+1:

dhruvdutt avatar Mar 20 '18 18:03 dhruvdutt

Working!

siddhant1 avatar Mar 18 '19 14:03 siddhant1

this is a big issue, so i recommend making small PR's!

catarak avatar Mar 20 '19 20:03 catarak

@catarak As the task is huge, I too would like to contribute to this.

shakeabi avatar Mar 20 '19 21:03 shakeabi

Are we prefer the promise .then chains, or should the code be using async/await? I would prefer the latter for readability

meiamsome avatar Mar 21 '19 03:03 meiamsome

i definitely prefer async / await! i'll update the issue title.

catarak avatar Mar 21 '19 20:03 catarak

We have to change the error handling mechanics with async/await , I have some links , I will post them here

siddhant1 avatar Mar 21 '19 20:03 siddhant1

There's an in-depth conversation about some of the struggles of using async-await with Express: https://github.com/processing/p5.js-web-editor/pull/973

TL;DR It makes sense to include an async middleware like express-async-handler, or update to a different Node framework, like Fastify or Koa.

catarak avatar Feb 04 '20 22:02 catarak

@raclim Can I work on this issue?

yugalkaushik avatar May 25 '25 16:05 yugalkaushik

@yugalkaushik feel free to give it a go! I'd echo an earlier comment on breaking this down into smaller PRs!

raclim avatar May 27 '25 15:05 raclim

@raclim hey I would also like to work on htis can I ? submit a PR as well

hxrshxz avatar Oct 08 '25 14:10 hxrshxz