EN · DE · RU · FR · ES

#2755: prefix.js

projectforge-webapp/src/utilities/prefix.js ES Module (single default export) · projectforge-webapp/src/utilities/prefix.js 2 lines · 1 code · 1 comments · 0 blank
A single-line ES module that exports the React application's URL prefix as a string constant. This module serves as the central routing prefix definition consumed by all frontend components that need to construct absolute URLs for API calls, navigation, and resource references. By centralizing the prefix in one consumable module, changing the application's base URL (e.g., from / to /react/) requires modifying only this file, with all dependent modules automatically picking up the change through their import statements without cascading edits.

Architecture

This module is the simplest possible building block in the ProjectForge webapp's routing architecture. It is imported by higher-level utilities like rest.js (the REST URL builder) to construct service endpoints, and by components that generate navigation links. The exported default value is a plain string — no function calls, no side effects — which makes it trivially testable and safely tree-shakeable by the bundler.

Git History

CommitWhat changed
974ececd9Added a comment line ("Defines the root react uri:") above the export to clarify the file's purpose for developers. Purely a documentation addition; the export itself was unchanged.
578ca5973Changed the exported prefix from '/' to '/react/', reflecting the relocation of the React single-page application from the application root to a dedicated sub-path. This was a significant routing change that affected all URL construction in the webapp.
20777ce4cCreated the file with the initial export of '/'. Established the pattern of a dedicated prefix module rather than hardcoding URLs throughout the codebase.