Skip to content

Integrate melange-express bindings for type-safe Express.js usage

Fixes #1: Replace custom Express bindings with melange-express

Overview

This MR replaces the placeholder custom Express bindings with the proper melange-express package from qwickshifts/melange-express, providing type-safe Express.js functionality for the API server.

Changes Made

Removed Custom Implementation

  • Deleted packages/bindings/src/Express.re (custom placeholder bindings)
  • Replaced with proper melange-express package usage

Enhanced Server Implementation

  • Comprehensive Express setup using melange-express bindings
  • Type-safe HTTP handling with proper ReasonML types
  • Middleware system with functional composition patterns

New Features Added

Middleware Stack

  • CORS middleware with configurable origins
  • JSON body parsing with Express built-in middleware
  • Request logging for HTTP method and path tracking
  • Security headers (disabled x-powered-by header)

API Endpoints

  • GET / - Welcome message with API information
  • GET /health - Health check with timestamp and service info
  • GET|POST /graphql - GraphQL endpoint placeholder (ready for PostGraphile)

Configuration

  • Configurable server settings (port, database URL, JWT secret, CORS origins)
  • Environment-ready structure for easy extension
  • Proper error handling for server startup failures

Architecture Benefits

Type Safety

  • Compile-time guarantees for HTTP operations
  • Type-safe middleware composition
  • Structured responses with proper JSON typing

Maintainability

  • Functional patterns with pure functions and immutable data
  • Modular design separating concerns
  • Consistent error handling throughout

Developer Experience

  • Clear API structure with well-defined endpoints
  • Comprehensive logging for debugging
  • Ready for PostGraphile integration

Ready for review!

Merge request reports

Loading