Configuration of Share Endpoint and Removal of API Endpoint

This section shows how to correctly update the project to ensure all the configuration are loaded inside the embedded apps. The MapStore project uses specific entry points for the embedded pages to reduce the size of these apps.

Here the entry points name for the embed pages:

  • embedded.jsx used to embed map and included in the embedded.html file
  • dashboardEmbedded.jsx used to embed dashboard and included in the dashboard-embedded.html file
  • geostoryEmbedded.jsx used to embed geostory and included in the geostory-embedded.html file

Set configuration paths and files

We anticipated some of these configuration inside the customization section. Here we are applying similar configurations to the embed entry points (js/dashboardEmbedded.jsx, js/embedded.jsx and js/geostoryEmbedded.jsx)

Import the custom.css that include the custom theme in the embed entry points

+ import '../assets/css/custom.css';

Update the embed entry points to use the project localConfig.json file

- ConfigUtils.setLocalConfigurationFile('MapStore2/web/client/configs/localConfig.json');
+ ConfigUtils.setLocalConfigurationFile('configs/localConfig.json');

Update the embed entry points to use the project translations

- ConfigUtils.setConfigProp('translationsPath', './MapStore2/web/client/translations');
+ ConfigUtils.setConfigProp('translationsPath', ['./MapStore2/web/client/translations', './translations']);

Remove API entry

The creation script of MapStore adds the API entry by default but in most of the cases is not really needed and it could need additional adjustment. We suggest to remove this entry point and related configuration as follow:

Remove the MyMapStoreProject-api from the prod-webpack.config.js and webpack.config.js

bundles: {
    'MyMapStoreProject': path.join(__dirname, "js", "app"),
    'MyMapStoreProject-embedded': path.join(__dirname, "js", "embedded"),
-   'MyMapStoreProject-api': path.join(__dirname, "MapStore2", "web", "client", "product", "api"),
    'geostory-embedded': path.join(__dirname, "js", "geostoryEmbedded"),
    "dashboard-embedded": path.join(__dirname, "js", "dashboardEmbedded")
},

Hide the API section from all the Share plugins configuration instances in the configs/localConfig.json file

{
    "name": "Share",
    "cfg": {
+       "showAPI": false,

Hide the API section from the share tool included in the homepage cards by changing the configuration of the Maps plugin inside the configs/localConfig.json file

{
    "name": "Maps",
    "cfg": {
+       "showAPIShare": false,
        "mapsOptions": {
            "start": 0,
            "limit": 12
        },
        "fluid": true
    }
},