Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.amplication.com/llms.txt

Use this file to discover all available pages before exploring further.

Event Name

LoadStaticFiles

Event Parameters

source
string
The source directory containing the static files to load.
basePath
string
The base path in the project where static files should be loaded into.
async afterLoadStaticFiles(
  context: dotnetTypes.DsgContext,
  eventParams: dotnet.LoadStaticFilesParams,
  files: FileMap<CodeBlock>
): Promise<FileMap<CodeBlock>> {
  const { resourceInfo } = context;
  if (!resourceInfo) return files;

  const resourceName = pascalCase(resourceInfo.name);

  const destPath = `${eventParams.basePath}/src/APIs/Common/Auth/ProgramAuthExtensions.cs`;
  const filePath = resolve(
    __dirname,
    "./static/common/auth/ProgramAuthExtensions.cs"
  );

  const programAuthExtensionsFileMap = await createStaticFileFileMap(
    destPath,
    filePath,
    context,
    [
      CsharpSupport.classReference({
        name: `${resourceName}DbContext`,
        namespace: `${resourceName}.Infrastructure`,
      }),
    ]
  );

  return files;
}