Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recommended: a few fundamental changes #2

Open
zboldyga opened this issue Nov 6, 2017 · 0 comments
Open

recommended: a few fundamental changes #2

zboldyga opened this issue Nov 6, 2017 · 0 comments

Comments

@zboldyga
Copy link
Contributor

zboldyga commented Nov 6, 2017

@tkavukat @sandeepkesarkar While building encounter-mongo-services I made some substantial changes to the structure of the project. I issued a pull request to this project with an updated seed project a while back, but since then I've deviated even further.

I think it might make sense if I take 1 week in December to migrate all of these changes into the seed project. I think this would give you a sufficient seed project for all node-based API-type services for the next 2+ years, and would give your team a way to hit the ground running with unit testing.

More specifically, these are some areas where I deviated:

  1. The seed project wasn't using Promises, and it was also combining try/catch and callback error handling (which is considered a no-no). The combination of these items means you're necessarily going to have lots of nested callbacks and improperly handled errors... Instead, I've migrated to using Promises and their built-in .catch error handling, alongside a library that the creators of Node.js recommend using for error handling. I think we should update the seed to fully use this approach. If I move these items to the seed, it will be easy for you to hit the ground running with Promises and have better error handling / reporting on new projects.

  2. Originally there wasn't a unit testing system in place. After I added the system, I then needed to change a good amount of your code using dependency injection so that it is test-able. I haven't moved those adaptations to your seed project yet... If you want to use unit testing in future projects, these changes should be moved over.

  3. The default error reporting provided was incomplete. There is a more robust framework being used in part of the encounter-mongo-services project which it may make sense to migrate to the seed... While using other RxNT APIs, I noticed a common trend of only 500 errors being reported, and services timing out when things went wrong. I think this would resolve those types of errors.

Lastly, I have not linked errors to any kind of logging system. I think this should be implemented in the seed. I can then move this over to encounter-mongo-services.

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

No branches or pull requests

1 participant