Skip to content

docs: bugfix example and make idiomatic to express#2

Open
coolaj86 wants to merge 2 commits intosearchunify:mainfrom
coolaj86:express
Open

docs: bugfix example and make idiomatic to express#2
coolaj86 wants to merge 2 commits intosearchunify:mainfrom
coolaj86:express

Conversation

@coolaj86
Copy link
Copy Markdown

@coolaj86 coolaj86 commented Dec 11, 2021

I'm assuming that this example is intended to be geared towards people who use express, so I made it more express-like.

  • fix use of single quotes where template string was intended
  • add "use strict" because this is node code, not transpiled
  • use app (the normal name of an express router) rather than server
  • no redundant return which may be confusing to the reader (there's nothing being returned)
  • consistent use of single quotes (rather than mixing single and double quotes)
  • go full-on async/await (using .catch() rather than try{})
  • use express' built-in next(err) handler rather than a one-off error handler
  • add some whitespace for readability

Preview

See the concise diff at 46a5302 (this is built in part on the prettier PR, but just the README part)

Preview at https://github.com/coolaj86/su-sdk/tree/express#execution

@coolaj86 coolaj86 changed the title docs: make example idiomatic to express docs: bugfix example and make idiomatic to express Dec 11, 2021
@coolaj86 coolaj86 force-pushed the express branch 3 times, most recently from c6c49eb to 5226fa3 Compare December 11, 2021 03:54
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.

1 participant