Skip to content

Pams.API.Core

reference
1 min readUpdated

Kind: Module

Source: Pams/API/Pams.API.Core/Pams.API.Core.csproj (line 1)

Part of: Pams

.NET project in solution

Pams.API.Core is a .NET project in the Pams solution. It holds API-core code and acts as a project boundary for the API layer when referenced by an API host or other solution projects.

Diagram

mermaid
graph TD
    Client[JavaScript or TypeScript client] --> Host[Pams API host]
    Host --> Core[Pams.API.Core]
    Core --> DotNet[.NET runtime]

Usage

ts
// Pams.API.Core runs on the server. Browser code calls the API host
// that references this project.

export async function callPamsApi<T>(
  apiBaseUrl: string,
  route: string,
  init: RequestInit = {},
): Promise<T> {
  const response = await fetch(new URL(route, apiBaseUrl), {
    ...init,
    headers: {
      Accept: "application/json",
      ...init.headers,
    },
  });

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

  return response.json() as Promise<T>;
}

const data = await callPamsApi<unknown>(
  import.meta.env.VITE_PAMS_API_URL,
  "/api/your-route",
);

AI Coding Instructions

  • Keep API-core code inside Pams.API.Core and reference it from the API host project.
  • Do not import the .csproj from browser code; TypeScript clients call the hosted API over HTTP.
  • Check API routes, authentication, and response contracts in the API host before adding client calls.
  • Configure API base URLs through environment settings instead of hardcoding host addresses.

Relationships

  • DEPENDS_ON → Microsoft.EntityFrameworkCore.SqlServer
  • DEPENDS_ON → Microsoft.EntityFrameworkCore.Tools
  • DEPENDS_ON → Microsoft.Graph
  • DEPENDS_ON → Microsoft.Identity.Client
  • DEPENDS_ON → Newtonsoft.Json

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