examples
examples copied to clipboard
Feature/fastify examples session
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
@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 )
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.
ok, understood. I thought that was what you would say. Will make appropriate changes.
Then I shall try that. Live and Learn :)
cc @mhdawson is including an SSL cert here okay given the cryptography exports thing?
oops didn't mean to close
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.
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.
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