본문으로 건너뛰기

ApiHelper

The @churchapps/apihelper package provides server-side utilities for all ChurchApps Express.js APIs. It includes the base controller class, JWT authentication middleware, database utilities, and AWS integrations that every API project depends on.

Before You Begin

What's Included

  • CustomBaseController -- base class for API controllers
  • Auth middleware -- JWT authentication via CustomAuthProvider
  • Database utilities -- DB.query, EnhancedPoolHelper for MySQL connection management
  • AWS integrations -- helpers for S3, SSM Parameter Store, and other AWS services
  • Inversify DI setup -- dependency injection container configuration

Setup for Local Development

  1. Clone the repository:

    git clone https://github.com/ChurchApps/ApiHelper.git
  2. Install dependencies:

    cd ApiHelper && npm install
  3. Build the package (compiles TypeScript to dist/):

    npm run build
  4. Make it available for local linking:

    npm link

Key Commands

CommandDescription
npm run buildCompile TypeScript to dist/
npm run lintRun ESLint
npm run lint:fixRun ESLint with auto-fix
npm run formatFormat code with Prettier
정보

This package is a dependency of every ChurchApps API. When making changes, use npm link to test against an API locally before publishing.

  • Helpers -- The base utility package that this package depends on
  • Module Structure -- How controllers and auth middleware are used in API modules
  • Local API Setup -- Setting up the API for local development