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
- Install Node.js and Git -- see Prerequisites
- Familiarize yourself with the npm link workflow for local development
- This package depends on
@churchapps/helpers
What's Included
- CustomBaseController -- base class for API controllers
- Auth middleware -- JWT authentication via
CustomAuthProvider - Database utilities --
DB.query,EnhancedPoolHelperfor 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
-
Clone the repository:
git clone https://github.com/ChurchApps/ApiHelper.git -
Install dependencies:
cd ApiHelper && npm install -
Build the package (compiles TypeScript to
dist/):npm run build -
Make it available for local linking:
npm link
Key Commands
| Command | Description |
|---|---|
npm run build | Compile TypeScript to dist/ |
npm run lint | Run ESLint |
npm run lint:fix | Run ESLint with auto-fix |
npm run format | Format code with Prettier |
info
This package is a dependency of every ChurchApps API. When making changes, use npm link to test against an API locally before publishing.
Related Articles
- 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