@cs124/cors
v2026.1.2
Published
CORS (Cross-Origin Resource Sharing) configuration and middleware for the CS124 platform.
Readme
@cs124/cors
CORS (Cross-Origin Resource Sharing) configuration and middleware for the CS124 platform.
Overview
This library provides:
- CORS middleware configuration for Koa.js servers
- Standardized CORS policies across all CS124 services
- Development and production CORS settings
Installation
# This library is part of the CS124 monorepo
# Install dependencies via Rush
rush updateUsage
import { corsMiddleware } from "@cs124/cors"
// In your Koa server
app.use(corsMiddleware)Development
Prerequisites
- Node.js 22.18.0
- Rush (for monorepo management)
Commands
# Build the library
rushx build
# Run quality checks
rushx check
# Format code
rushx prettier
# Lint code
rushx eslint
# Type check
rushx tsc
# Check for unused dependencies
rushx depcheckProject Structure
lib/cors/
├── src/
│ └── index.ts # Main CORS configuration
├── dist/ # Built output (generated)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── tsconfig.build.json # Build-specific TypeScript configTechnology Stack
- Language: TypeScript (ES2019 target)
- Build: TypeScript compiler
- Target: Koa.js servers
Contributing
- Always run
rushx checkbefore committing - Follow existing code conventions
- Use TypeScript for type safety
- Ensure all tests pass
- Update documentation as needed
