Skip to content

API

reference
1 min readUpdated

Kind: Module

Source: Pams/API (line 1)

Part of: Pams

.NET project in solution

The API module is the .NET project in the Pams solution. It hosts server-side API functionality and serves as the integration boundary between clients and application services.

Diagram

mermaid
graph TD
  Client[Client Application] --> API[Pams/API .NET Project]
  API --> Services[Application Services]
  Services --> Data[Data Storage]

Usage

ts
const apiBaseUrl = "https://example.test";

async function callApi(path: string, options: RequestInit = {}) {
  const response = await fetch(`${apiBaseUrl}${path}`, {
    headers: {
      "Content-Type": "application/json",
      ...options.headers,
    },
    ...options,
  });

  if (!response.ok) {
    throw new Error(`API request failed: ${response.status}`);
  }

  return response.json();
}

const result = await callApi("/api/resource");
console.log(result);

AI Coding Instructions

  • Keep HTTP endpoint handling in the API project and delegate business rules to application services.
  • Match existing solution conventions for routing, dependency injection, configuration, and error responses.
  • Avoid placing client-specific behavior in API controllers or endpoint handlers.
  • Validate request input before passing it to application services.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Declared in (1)

  • PamsPams/Pams.sln:1

Was this page helpful?

Download as PDF