Project Architecture Practices (6)ġ.1 Structure your solution by components #strategic #updatedġ.2 Layer your components, keep the web layer within its boundaries #strategic #updatedġ.3 Wrap common utilities as packages, consider publishingġ.4 Use environment aware, secure and hierarchical config #updatedġ.5 Consider all the consequences when choosing the main framework #newġ.6 Use TypeScript sparingly and thoughtfully #newĢ.1 Use Async-Await or promises for async error handlingĢ.2 Extend the built-in Error object #strategic #updatedĢ.3 Distinguish operational vs programmer errors #strategic #updatedĢ.4 Handle errors centrally, not within a middleware #strategicĢ.5 Document API errors using OpenAPI or GraphQLĢ.6 Exit the process gracefully when a stranger comes to town #strategicĢ.7 Use a mature logger to increase errors visibility #updatedĢ.8 Test error flows using your favorite test framework #updatedĢ.9 Discover errors and downtime using APM productsĢ.10 Catch unhandled promise rejections #updatedĢ.11 Fail fast, validate arguments using a dedicated libraryĢ.12 Always await promises before returning to avoid a partial stacktrace #newĢ.13 Subscribe to event emitters 'error' event #newģ.2 Use Node.js eslint extension plugins #updatedģ.3 Start a Codeblock's Curly Braces on the Same Lineģ.6 Use naming conventions for variables, constants, functions and classesģ.8 Require modules first, not inside functionsģ.9 Set an explicit entry point to a module/folder #updatedģ.11 Use Async Await, avoid callbacks #strategicģ.13 Avoid effects outside of functions #newĤ. Hold on, I've just launched my beyond-the-basics testing course, which is on a □ limited-time sale until August 7th Best practices have additional info - most bullets include a □Read More link that expands on the practice with code examples, quotes from selected blogs, and more informationīy Yoni Goldberg Learn with me: As a consultant, I engage with worldwide teams on various activities like workshops and code reviews. We'd love to see you contributing here, whether that is fixing code mistakes, helping with translations, or suggesting brilliant new ideas. New issues and pull requests are created every day to keep this live book updated. It is the largest compilation, and it is growing every week - currently, more than 80 best practices, style guides, and architectural tips are presented. You are reading dozens of the best Node.js articles - this repository is a summary and curation of the top-ranked content on Node.js best practices, as well as content written here by collaboratorsĢ. Welcome! 3 Things You Ought To Know Firstġ. □ Curious to see examples? We have a starter: Visit Practica.js, our application example and boilerplate (beta) to see some practices in action ✨ Easily focus on new content: Already visited before? Search for #new or #updated tags for new content only □ Modernized to 2023: Tons of text edits, new recommended libraries, and some new best practices Follow us on Twitter! in a different language: CN, FR, BR, RU, PL, JA, EU ( ES, HE, KR and TR in progress! )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |