Skip to content

Refactor: Split monolithic index.js into modular Express application … - #35

Open
JinadJay wants to merge 2 commits into
EquipChain:mainfrom
JinadJay:refactor/modular-express-structure
Open

Refactor: Split monolithic index.js into modular Express application …#35
JinadJay wants to merge 2 commits into
EquipChain:mainfrom
JinadJay:refactor/modular-express-structure

Conversation

@JinadJay

Copy link
Copy Markdown
Contributor

…structure

  • Create src/config/index.js for centralized configuration
  • Create src/routes/index.js for route aggregation
  • Create src/services/index.js for service initialization
  • Create src/app.js for Express app configuration
  • Create src/server.js for HTTP server with graceful shutdown
  • Update index.js to minimal entry point
  • Update package.json scripts
  • Update test imports to use src/app.js
  • Add unit tests for app.js
  • Add integration tests for server.js

This refactoring improves separation of concerns, testability, and maintainability. The app can now be imported without starting the server, enabling faster tests. Graceful shutdown handling for SIGTERM/SIGINT signals is implemented.

Resolves #28

…structure

- Create src/config/index.js for centralized configuration
- Create src/routes/index.js for route aggregation
- Create src/services/index.js for service initialization
- Create src/app.js for Express app configuration
- Create src/server.js for HTTP server with graceful shutdown
- Update index.js to minimal entry point
- Update package.json scripts
- Update test imports to use src/app.js
- Add unit tests for app.js
- Add integration tests for server.js

This refactoring improves separation of concerns, testability, and maintainability.
The app can now be imported without starting the server, enabling faster tests.
Graceful shutdown handling for SIGTERM/SIGINT signals is implemented.

Resolves EquipChain#28
@KarenZita01

Copy link
Copy Markdown
Member

Failed CI. Try and fix it

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.

[Refactor] Split Monolithic index.js into Modular Express Application Structure

2 participants