1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Adds TypeScript note and corrects a typo.

This commit is contained in:
Simon Prickett
2021-10-21 21:48:29 +01:00
parent 6fc631781a
commit dec504851e

View File

@@ -14,20 +14,20 @@ We'd love to see more examples here. If you have an idea that you'd like to see
When adding a new example, please follow these guidelines: When adding a new example, please follow these guidelines:
* Add your code in a single JavaScript file per example, directly in the `examples` folder * Add your code in a single JavaScript or TypeScript file per example, directly in the `examples` folder
* Do not introduce other dependencies in your example * Do not introduce other dependencies in your example
* Give your `.js` file a meaningful name using `-` separators e.g. `adding-to-a-stream.js` * Give your `.js` file a meaningful name using `-` separators e.g. `adding-to-a-stream.js` / `adding-to-a-stream.ts`
* Indent your code using 2 spaces * Indent your code using 2 spaces
* Use the single line `//` comment style and comment your code * Use the single line `//` comment style and comment your code
* Add a comment at the top of your `.js` file describing what your example does * Add a comment at the top of your `.js` / `.ts` file describing what your example does
* Add a comment at the top of your `.js` file describing any Redis commands that need to be run to set up data for your example (try and keep this minimal) * Add a comment at the top of your `.js` / `.ts` file describing any Redis commands that need to be run to set up data for your example (try and keep this minimal)
* Use semicolons * Use semicolons
* Use `async` and `await` * Use `async` and `await`
* Use single quotes, `'hello'` not `"hello"` * Use single quotes, `'hello'` not `"hello"`
* Place your example code in a single `async` function where possible, named according to the file name e.g. `add-to-stream.js` would contain `const addtoStream = async () => { ... };`, and call this function at the end of the file e.g. `addToStream();` * Place your example code in a single `async` function where possible, named according to the file name e.g. `add-to-stream.js` would contain `const addtoStream = async () => { ... };`, and call this function at the end of the file e.g. `addToStream();`
* Unless your example requires a connection string, assume Redis is on the default localhost port 6379 with no password * Unless your example requires a connection string, assume Redis is on the default localhost port 6379 with no password
* Use meaningful example data, let's not use `foo`, `bar`, `baz` etc! * Use meaningful example data, let's not use `foo`, `bar`, `baz` etc!
* Leave on empty line at the end of your `.js` file * Leave an empty line at the end of your `.js` file
* Update this `README.md` file to add your example to the table * Update this `README.md` file to add your example to the table
Use [connect-as-acl-user.js](connect-as-acl-user.js) as a guide to develop a well formatted example script. Use [connect-as-acl-user.js](connect-as-acl-user.js) as a guide to develop a well formatted example script.