hiyaryan / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling distorted thinking and finding alternative modes of thought (i.e. reframing) while cognitive distortions are occurring. The CDJ does that work for you. -- The CDJ is in beta testing!!
https://thecdj.app
3 stars 0 forks source link

Load environment variables at the very top of the application entry. #72

Closed hiyaryan closed 7 months ago

hiyaryan commented 7 months ago

This PR performs some refactoring at the entry point of the application.

Since it was decided to separate the app setup (app.js) and server launching (index.js) into separate files with index.js being the entry to the application, app requires being imported into index.js.

Some refactoring was done to move the loading of environment variables to the top of index.js where it was previously loaded twice in both files depending on the node environment.

Additionally, two express instances were created and then combined before spinning up the server, this has been changed to only one express instance returned from app.js on import.