examples icon indicating copy to clipboard operation
examples copied to clipboard

Feature/fastify examples session

Open ghinks opened this issue 5 years ago • 9 comments

A slightly more advanced example starting with

  • localhost http local memory store
  • localhost https local memory store
  • localhost https redis memory store with docker-compose

ghinks avatar Aug 19 '20 18:08 ghinks

@mcollina ok, so there may be a misunderstanding by myself on this subject. Should all route handlers be async even if they are synchronous themselves. Is this a general practice? Or am I doing this correctly but you would rather see examples of asynchronous behavior with these session examples too? ( PS sincere thanks for reviewing )

ghinks avatar Aug 22 '20 17:08 ghinks

Should all route handlers be async even if they are synchronous themselves. Is this a general practice?

I recommend this for examples because adding an asynchronous behavior is the normal case. There are significant differences between returning a value (or throwing) in an async function vs a normal one as everything is wrapped in a promise, it resolves in the next tick etc.

Starting from v3 this pattern is supported so everything works fine here, but it looks good only in non-production cases.

mcollina avatar Aug 23 '20 14:08 mcollina

ok, understood. I thought that was what you would say. Will make appropriate changes.

ghinks avatar Aug 24 '20 12:08 ghinks

Then I shall try that. Live and Learn :)

ghinks avatar Aug 28 '20 11:08 ghinks

cc @mhdawson is including an SSL cert here okay given the cryptography exports thing?

bnb avatar Sep 25 '20 19:09 bnb

oops didn't mean to close

bnb avatar Sep 25 '20 19:09 bnb

many thanks for the comments. I shall update the readme to follow the style suggested. The certificates are local host and are self signed. There are no cryptographic secrets within them they just allow for session to be tested on localhost using the secure setting. Otherwise the example is not representative.

ghinks avatar Sep 27 '20 11:09 ghinks

I have had a look at the example readme files you gave. Apart from the IBM example they are all installable modules and only the IBM readme is an example, so they don't really pertain to this type of examples repo. The IBM readme does in fact start off with in this tutorial. I am not really sure what is being asked for.

ghinks avatar Sep 27 '20 12:09 ghinks

Here's an example of a server from @Thiruppathi that aligns more with what's being asked for :)

https://github.com/nodejs/examples/commit/6f689d52269b4c0d818f0835d313f99137311904

bnb avatar Dec 10 '20 18:12 bnb