Skip to content

Initial Hero API Server Setup and Configuration - #26

Open
Jockstrap6334 wants to merge 8 commits into
HermanL0201:e76a0895-0a2b-426e-b43b-059fa02aee8ffrom
Jockstrap6334:feature-hero-api-server-setup-1749263192
Open

Initial Hero API Server Setup and Configuration#26
Jockstrap6334 wants to merge 8 commits into
HermanL0201:e76a0895-0a2b-426e-b43b-059fa02aee8ffrom
Jockstrap6334:feature-hero-api-server-setup-1749263192

Conversation

@Jockstrap6334

@Jockstrap6334 Jockstrap6334 commented Jun 7, 2025

Copy link
Copy Markdown

Initial Hero API Server Setup and Configuration

Description

Task

Create initial server setup for hero API

Acceptance Criteria

  • Server successfully starts on configured port
  • Middleware correctly handles JSON and URL-encoded requests
  • Error handling middleware prevents server crashes
  • Server can be instantiated with default or custom port configuration

Summary of Work

This pull request establishes the foundational server configuration for the Hero API, implementing a robust and flexible Express.js server with comprehensive middleware and error handling.

Key Changes:

  • Utilized existing Server class in src/server.ts as the base for API configuration
  • Implemented essential middleware for request parsing and error handling
  • Configured basic server startup routine
  • Added support for JSON and URL-encoded request bodies
  • Implemented centralized error handling middleware

Implementation Details:

  1. Server Configuration:

    • Default port set to 3000
    • Support for dynamic port configuration
    • Centralized middleware initialization
  2. Middleware Setup:

    • express.json(): Parse incoming JSON payloads
    • express.urlencoded(): Handle URL-encoded form data
    • Global error handling middleware for unexpected errors
  3. Startup Mechanism:

    • start() method to launch the server
    • Console logging for server startup confirmation
    • getApp() method for potential test and extension scenarios

Notes:

  • Future iterations will include more sophisticated logging
  • Error handling can be extended based on specific requirements
  • Modular design allows easy middleware and route additions

Changes Made

  • Utilized existing Server class in src/server.ts
  • Configured middleware for JSON and URL-encoded parsing
  • Implemented global error handling middleware
  • Added server startup method with port configuration
  • Provided method to access Express application instance

Tests

  • Server can be instantiated with default port
  • Server can be instantiated with custom port
  • Middleware correctly parses JSON payloads
  • Middleware correctly parses URL-encoded payloads
  • Error handling middleware prevents unhandled exceptions

Signatures

Staking Key

DWBqahm2PaMoi28xYhwk66LkLYbZw7Df7AKb5hKRrBf: 7gsgWAfiLK2aLTtg78o8ffSiH9emJj6ovHKu5hU4x1JuXneYTGYayGKWbDma3Ljw11mpRYdepxLf5g5qVoJAA24k6La119ddHWdzMPrHg7BbqZQD3c2QyYnDGzNv4oybMKYvMVNGtDg2ZRgXWS7fQwWnnqqLxXNYqRTnwhSV9KBzbTSuDt7PaRwaZg3Eb7NH7UUJ1dGhzmWra4sFXyUDYQ1Fu2iReQMoNvmnVEYQSegtoWpFjxhbrFpvqy9j89c5Qvmn14tkhWJwhD8s557DheVasadGSaGQtKmLomApYPWWn1LJimoqwpgctZSq6frfLUwwhBkgCbfuVT7cbXJaShVuj2RJ3zR5rgMFuEpN2ptHS23WfFqUqP2PHtHVTdunoLcHt3Uww4YZoKCatv3tsRsKcGrmyhaYDwnQc

Public Key

2zjmVMjbiRMA7LSoefNKBMkhZyoK7hVpVz3xJU7m2NxW: 3NvssvN4EYRT8WneDsqC2Av1f1mhzjuiFUeoHrBjPm86qt1npZNnqUkXDMHjU2z1J8S2GakN2ivKU7myfq37oN4wYokuFvSGwzciRyBv9uN3xGojzULjhmnL7xaK7G8Y5M5mtzs5ZWtp4uaERgHac997hLyQsaqxHXwBa4R28uZt53YrvjHy8Ebv38F9DGQV6JZvuAsiVnTffMLiWh8Yq1paYNnACUjGsCqk4Eg1Q4woZWwb2Z7y5NuabVMZ7zyDQStgvPBf4NxKCb7DcKdTxXUds5wSVKbRLHqkHXNSohPTcqCQwrZ3KfscNBeaFaRb3YHBPrPmoqjtwpMQBcAoDPtAoFM87DPX4PSUUkQqwirLfJdzmy63mkziXkA3YJpbiAxxqBRtdEEVT6rAwGpej6EemJ9YzC7NFhzAp

@Jockstrap6334 Jockstrap6334 changed the title [WIP] Initial Express Server Setup for Hero API Initial Hero API Server Setup and Configuration Jun 7, 2025
@Jockstrap6334
Jockstrap6334 marked this pull request as ready for review June 7, 2025 02:29
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.

1 participant