mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
- 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.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 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";
|
|
|
|
// Fetch a list of resources used in the application
|
|
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
|
|
const DataTypes: Array<DataTypeDocumentation> = DataTypeUtil.getDataTypes();
|
|
|
|
export default class ServiceHandler {
|
|
// Handles the HTTP response for a given request
|
|
public static async executeResponse(
|
|
req: ExpressRequest,
|
|
res: ExpressResponse,
|
|
): Promise<void> {
|
|
let pageTitle: string = "";
|
|
let pageDescription: string = "";
|
|
|
|
// Get the 'page' parameter from the request
|
|
const page: string | undefined = req.params["page"];
|
|
const pageData: Dictionary<unknown> = {};
|
|
|
|
// Set the default page title and description
|
|
pageTitle = "Errors";
|
|
pageDescription = "Learn more about how we return errors from API";
|
|
|
|
// Render the response using the given view and data
|
|
return res.render(`${ViewsPath}/pages/index`, {
|
|
page: page,
|
|
resources: Resources,
|
|
dataTypes: DataTypes,
|
|
pageTitle: pageTitle,
|
|
enableGoogleTagManager: IsBillingEnabled,
|
|
pageDescription: pageDescription,
|
|
pageData: pageData,
|
|
});
|
|
}
|
|
}
|