Try our conversational search powered by Generative AI!

Rest Store URL 404

Vote:
 

I have created a module with a rest store but the url returns a 404.  I have the follwing: 

    [RestStore("teststore")]
    public class StoreHandlerSample : RestControllerBase
    return declare("ddd.ModuleInitializer", [_Module], {

        initialize: function () {

            this.inherited(arguments);
            var registry = this.resolveDependency("epi.storeregistry");

            registry.create("teststore", this._getRestPath("teststore"));
        },

        _getRestPath: function (name) {
            return routes.getRestPath({ moduleArea: "Demo", storeName: name });
        }
    });

My module is called demo but when I hit localhost/modules/Demo/Stores/teststore I am getting a 404 error.

Any help would be appreciated.

Thanks

#198601
Oct 31, 2018 16:07
Vote:
 

hi Pa Nije, 

1- Please check if the module was loaded, you can see it in dev tools

2- The ModuleInitializer should be included in module.config. Something like this

      <clientModule initializer="pathToYourModuleInitializationFile/ModuleInitializer">         <moduleDependencies>           <add dependency="CMS" type="RunAfter" />         </moduleDependencies>       </clientModule>
#199277
Nov 22, 2018 11:25
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.