Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json-server-async: a merge of json-reply and async-reply examples #207

Merged
merged 2 commits into from
Oct 2, 2021

Conversation

matteoredaelli
Copy link

I added a sample async json-reply starting from the two examples json-reply and async-reply
I'm not an expert of node.js, so can you look at it?

thanks
matteo

@kirsle
Copy link
Member

kirsle commented Feb 2, 2017

Instead of duplicating code, I wouldn't mind the json-server example being extended with some async examples.

  • By using replyAsync() to get a reply instead of reply()
  • And including at least one object macro that returns a promise. You can reuse the weatherman.js macro for now, but at some point I wanna find more diverse examples (and ones that don't depend on an API key).

It's probably much more natural for Express.js developers to use async everything if they can anyway, so it was actually kinda odd for the json-server example not to use asyncReply().

@matteoredaelli
Copy link
Author

It is what I did: usinf replyAsync in json-reply looking at weatherman.js But instead of modifing the example json-reply I creaed a new one...

@kirsle kirsle merged commit 03b75b2 into aichaos:master Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants