So I have created a PluginController as per this example.
[PluginController("AwesomeProducts")]
public class ProductsController : UmbracoApiController
{
public IEnumerable<string> GetAllProducts()
{
return new[] { "Table", "Chair", "Desk", "Computer", "Beer fridge" };
}
}
I manged to get everything working when this controller was added in my AppConfig folder but when I tried to move this to my plugin folder within App_Plugins then my angular post call returned a 404.
I guess my question is.
Where should be store the PluginControlls (AppCode or AppPlugins)?
If App_Code then how does this effect publishing my ContentApp? What extra step do I need to do? This will be the first content app I have published.
If App_Plugins then how do I get around the 404? Should the URL be slightly different them the documentation? Possibly this has changes for Umbraco8?
As I said I got this to work in the App_Config folder by using this URL.
~/Umbraco/AwesomeProducts/Products/GetAllProducts
At least part of this was answered in your other post (https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/94185-web-api-plugin-controller).
I believe to publish it, you just need to be sure to include the file in the manifest so that it gets placed in the app_code folder.
After having more of a dig around I have sort of answered my own question.
It seems other people are creating a separate project for the to store all the custom .net code which I previously was adding in the App_Config folder.
This is when built and the DLL is included in the Umbraco website project.
When it comes time to publish the new package simply select the dll which was referenced form the new project that was created.
This seems to work great and I've already created a few contentApps which appear to be working / publishing great. I will probably add these to Umbraco's package library over the next few days.
Umbraco 8 Where to store a ContentApp PluginController?
Hi Peeps,
I am trying to write my first content app and having a little trouble finding some documentation how to handle PluginControllers.
So my app uses a PluginController to do a load of logic. I then use my angular controller to post stuff there.
I have have been following some documentation here. https://our.umbraco.com/documentation/reference/routing/webapi/
So I have created a PluginController as per this example.
I manged to get everything working when this controller was added in my AppConfig folder but when I tried to move this to my plugin folder within App_Plugins then my angular post call returned a 404.
I guess my question is.
Where should be store the PluginControlls (AppCode or AppPlugins)?
If App_Code then how does this effect publishing my ContentApp? What extra step do I need to do? This will be the first content app I have published.
If App_Plugins then how do I get around the 404? Should the URL be slightly different them the documentation? Possibly this has changes for Umbraco8?
As I said I got this to work in the App_Config folder by using this URL. ~/Umbraco/AwesomeProducts/Products/GetAllProducts
Thanks in Advanced.
David
At least part of this was answered in your other post (https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/94185-web-api-plugin-controller).
I believe to publish it, you just need to be sure to include the file in the manifest so that it gets placed in the app_code folder.
Hi,
After having more of a dig around I have sort of answered my own question.
It seems other people are creating a separate project for the to store all the custom .net code which I previously was adding in the App_Config folder.
This is when built and the DLL is included in the Umbraco website project.
When it comes time to publish the new package simply select the dll which was referenced form the new project that was created.
This seems to work great and I've already created a few contentApps which appear to be working / publishing great. I will probably add these to Umbraco's package library over the next few days.
Kind Regards
David
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.