You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we start encapsulating all our code, things stop being global. Which is good. But the problem is we've been bad. And we've been keeping our schemas in global vars. Which is very bad. So let's make our schema's file export its schemas and then we'll require it in each file that uses it. Or better yet lets put it in middleware. So our routes file will include a boolean for each route that says if it needs schemas or not, and then if it does we'll load the schemas into req._schemas. This way we know exactly which routes access the database and we only load the schemas file once.
The text was updated successfully, but these errors were encountered:
If we start encapsulating all our code, things stop being global. Which is good. But the problem is we've been bad. And we've been keeping our schemas in global vars. Which is very bad. So let's make our schema's file export its schemas and then we'll require it in each file that uses it. Or better yet lets put it in middleware. So our routes file will include a boolean for each route that says if it needs schemas or not, and then if it does we'll load the schemas into req._schemas. This way we know exactly which routes access the database and we only load the schemas file once.
The text was updated successfully, but these errors were encountered: