Files
oneuptime/App/FeatureSet/APIReference/Service/Introduction.ts
Nawaz Dhandala acaab0fb1a Add documentation views and partials for error handling and content display
- Created NotFound.ejs for 404 error page with user-friendly messaging and navigation.
- Added ServerError.ejs for 500 error handling with retry and documentation links.
- Introduced Content.ejs partial for structured article content display.
- Developed Head.ejs partial for consistent head elements across pages.
- Implemented Header.ejs partial for navigation and branding.
- Created Nav.ejs partial for sidebar navigation with dynamic links.
- Added OpenSourceCommitment.ejs partial to highlight open-source contributions.
- Implemented Pagination.ejs partial for navigation between documentation sections.
2026-03-03 19:45:46 +00:00

47 lines
1.7 KiB
TypeScript

import { IsBillingEnabled } from "Common/Server/EnvironmentConfig";
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import DataTypeUtil, { DataTypeDocumentation } from "../Utils/DataTypes";
import { ExpressRequest, ExpressResponse } from "Common/Server/Utils/Express";
import Dictionary from "Common/Types/Dictionary";
// Get all resources and featured resources from ResourceUtil
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const DataTypes: Array<DataTypeDocumentation> = DataTypeUtil.getDataTypes();
const FeaturedResources: Array<ModelDocumentation> =
ResourceUtil.getFeaturedResources();
export default class ServiceHandler {
// Handle the API request
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
// Initialize page title and description
let pageTitle: string = "";
let pageDescription: string = "";
// Get the requested page from the URL parameters
const page: string | undefined = req.params["page"];
const pageData: Dictionary<unknown> = {};
// Set featured resources for the page
pageData["featuredResources"] = FeaturedResources;
// Set page title and description
pageTitle = "Introduction";
pageDescription = "API Reference for OneUptime";
// Render the index page with the required data
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
dataTypes: DataTypes,
pageTitle: pageTitle,
enableGoogleTagManager: IsBillingEnabled,
pageDescription: pageDescription,
pageData: pageData,
});
}
}