Skip to content
This repository was archived by the owner on Jul 11, 2026. It is now read-only.

Improve server/index.js: better error handling, security, config - #62

Merged
DeadIndian merged 3 commits into
DeadIndian:mainfrom
gssi962:improve-server-index
Aug 30, 2025
Merged

Improve server/index.js: better error handling, security, config#62
DeadIndian merged 3 commits into
DeadIndian:mainfrom
gssi962:improve-server-index

Conversation

@gssi962

@gssi962 gssi962 commented Aug 29, 2025

Copy link
Copy Markdown
Contributor

🚀 Pull Request

Description

This PR improves the server/index.js file by making the backend more secure, flexible, and easier to maintain.

Related Issue

Closes #48

Type of Change

This PR is an enhancement ⚡ to the backend. It improves server/index.js by adding configurable CORS, a 404 route handler, a better error handler, enhanced /api/health endpoint, security middlewares (helmet and rate-limit), and request logging (morgan). No bug fixes or documentation updates are included in this PR.

How Has This Been Tested?

Tested locally on server

Verified /api/health returns DB status and uptime

Tested unknown routes return 404 JSON

Verified CORS works with .env configuration

Checked logging via morgan

Verified server starts without errors

Screenshots (if applicable)

N/A – backend changes only

Checklist

  • [YES ] I followed the Contributing Guide
  • [YES ] My code follows the project’s style guidelines
  • [ YES] I performed a self-review of my code
  • [YES ] I updated documentation where necessary
  • [ YES] My changes generate no new warnings

@gssi962

gssi962 commented Aug 29, 2025

Copy link
Copy Markdown
Contributor Author

I have created a pull request for issue #48. Kindly review it.

@DeadIndian DeadIndian left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DeadIndian
DeadIndian merged commit c81c8e6 into DeadIndian:main Aug 30, 2025
@DeadIndian DeadIndian added enhancement New feature or request GSSoC'25 Part of GSSoC'25 program 1 ⭐ Beginner friendly OSCI'25 Part of open source connect - 2025 labels Aug 30, 2025
@gssi962

gssi962 commented Aug 30, 2025

Copy link
Copy Markdown
Contributor Author

I have one request. Kindly update my score of GSSOC and OSCI as today is the last date of contribution of OSCI.

@DeadIndian DeadIndian added the level 1 Beginner/easy label Aug 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1 ⭐ Beginner friendly enhancement New feature or request GSSoC'25 Part of GSSoC'25 program level 1 Beginner/easy OSCI'25 Part of open source connect - 2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Improve server/index.js with better error handling, security, and configuration

2 participants