Bootstrapping Aurelia - aurelia

Finally, I start to work with Aurelia. There is a starter kit available Here which facilitates initializing Aurelia. But it is a template which should be used within a Web Site template.
I have a pre-configured WebApi project and I want to use Aurelia in it. I've just added the starter kit files and folders to my project. But unfortunately it shows 27651 errors fo files in jspm_packages.
What am I doing wrong? Is there any Nuget bootstrapper for Aurelia available?

Start with the aspnetcore template from Here
You can use web api from the template.
You will be up and running in minutes.

If you are using Web API, starting from an MVC5 project might be faster.
The following link is an Aurelia starter kit with MVC5.
You will have to update it to the latest version of Aurelia, but I managed to make it work with web api 2 and oAuth authentication.
https://github.com/rmourato/Mvc5-Aurelia
A tutorial can be found here.
http://ruimourato.com/2016/01/26/running-aurelia-on-mvc5.html
Hope this helps.

Well you asked what the errors are from. First thing is that you should exclude the jspm_packages folder from VisualStudios solution explorer Right click on it and mark 'exclude from project'.
Next, setup your project on source control (git) if not already and add the following to your git .ignore file
jspm_packages/
node_modules/`
I would suggest creating a second project aside from your WebAPI project that can contain static html, css and js files and do your Aurelia application there separate from your Web API project but in the same solution.
I could possibly give you a solution that is already setup, that shows how to use web api along with aurelia. But it would take some time for me to setup.

For all of my projects using Aurelia, I use the aurelia-cli which you get through npm and I would also recommend this approach.
You can be up and running with hello world in under 5 minutes.
You will then be able to build all the appropriate bits and pieces to talk to your api.
http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/1

Related

Is it possible to integrate Webpack/VueJS with the Odoo Framework (v12)?

I'd like to integrate VueJS through WebPack in one of my custom Odoo modules, and have it start up automatically when I launch Odoo-bin.
Does anyone have a solution?
Is it even possible?
I know you can include VueJS as a simple .JS file in the module's template, but that means I can't use the .vue components supported by WebPack.
I also read that Odoo has its own JS framework, but I couldn't find good tutorials/documentation for it.
EDIT: To anyone that might be wondering how I solved this, here's what I did:
I initialized a package.json file in the root of my Odoo folder using npm init. I added a start script to the package that launches webpack and bundles all vue components in myAddons folder (where I store my custom modules), then launches Odoo through the python odoo-bin ... command. All that's left is to use npm start to start it all up.
This way, the vue components get bundled into single JS files, that I then add to the templates of my modules. This has a small inconvenient in that the first bundle has to be done manually in order to know which JS files need to be imported to the templates. Also, i'm still trying to figure out how to bundle the components of every single module separately. Will update this once I find a proper way to do it. ...Hopefully.
By default, odoo frontend part is heavily built upon backbone, jquery, underscore. If you want to use any other JS library, you have to make sure the compatibility in between them. The odoo backend parts of JS functionalities are written under web module can be found in odoo/addons/web/static/src/js directory in odoo community codes. The ecommerce/website part is under website* modules.
Along with the fact that the Odoo JS API documentation is basically non-existent (as of the time I am posting this) .. I would add the fact that its going to be like working with a moving target compared to calling Odoo's JSON-RPC API directly since their JSON-RPC API changes very little over different versions of Odoo.
Moreover, making JSON-RPC API calls with Axios is extremely simple. So just go directly to the server's JSON-RPC API from your Vue project.
This is what I am doing with at odooinvue.org which is basically a Vue project that uses Odoo in the back-end. That project is designed specifically as a resource for Vue developers that are trying to use Odoo in the back-end but have difficulty because they are new to Odoo development.
I suggest trying #StartupGuy's odooinvue, which is really nice.
With Odoo 14 they created a new modern frontend framework: Owl framework.
I have not tried it myself.

Integrating Polymer application with ExpressJS application

I use ExpressJS to build an application and after trying different frontend frameworks (vue and angular) I settled on google Polymer. I integrated the polymer app by including all the Polymer files in the Expressjs public folder (every file including package.json) and it works fine with my api routes.
Now my question is regarding this approach:
1-Is it safe to include it in the expressjs public folder? It's just html, css and js files.
2-If there is a better setup. What would be a better setup?
I hope someone out there with good experience and enough knowledge could share some practical advice with me. Please be a little specific and if you can share an application folder structure so I can understand it visually.
Yes, it should be safe, because Polymer is a client-side Framework, which means that all of its files have to be public anyway, but usually you serve the build-version of your project (Run "polymer build" with the options you need), which doesn't contain all the config-files (like package.json).

How to use external API within Yii2 application?

I'd like to use external API within Yii2 application.
I couldn't find any tutorial about it.
I'd like to know how to do it in a decent way - do I have to build separate module to use this API or organize it in another way?
Any simple examples would be appreciated.
I'd like to build a tool, to use external API of other online application. To be straightforward - I'd like to import invoices etc. from external accounting system to my Yii2 application. This accounting system has API and I wonder how to use it properly inside Yii2 application.
The perfect solution for now would be to install ready module like "yii2-accountingsystemname-api", then I put some login and password for this system and I'm good to go - I can use it inside my application like:
getInvoices->all() etc.
After doing a bit of research I have found this guide that explains how to use third-Party code with the Yii2 application:
http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html
This is a excerpt from that article:
Using Third-Party Libraries in Yii To use a third-party library in a
Yii application, you mainly need to make sure the classes in the
library are properly included or can be autoloaded.
Using Composer Packages Many third-party libraries are released in
terms of Composer packages. You can install such libraries by taking
the following two simple steps:
modify the composer.json file of your application and specify which
Composer packages you want to install. run composer install to install
the specified packages. The classes in the installed Composer packages
can be autoloaded using the Composer autoloader. Make sure the entry
script of your application contains the following lines to install the
Composer autoloader:
// install Composer autoloader
require(__DIR__ . '/../vendor/autoload.php');
// include Yii class file
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
I suggest that you read the article because there is lots of other valuable information that may help you, and possibly better suit your needs than what I copied above.
Best of luck with your project!

Web API Help page not showing XML

I have a Web API project in which I removed by hand Areas folder few months ago when we started development. Now after everything is finished I want to add API help pages but it is not working as expected.
I installed nuget package for help pages.
I uncommented line in HelpPageConfig.cs
I checked Generate documentation file (to App_Data folder)
When I open http://localhost:51665/help I get this: (No methods are shown)
Any idea what could be wrong? If I start new project from scratch everything works properly.
I suppose you've setup your project in two steps:
You should choose Build tab in API project Properties and set up XML Documentation file in Output section. For example: App_Data\XmlDocument.xml
Then you can updateHelpPageConfig.cs in method Register... in my case
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
When your project is in compilation process, take a look in output window, whether documentation is really generated.
Try to use older version of ASP.NET Help pages (version 5.2.2 works for me).
Install-Package Microsoft.AspNet.WebApi.HelpPage -Version 5.2.2

How to run a Sencha Architect MVC application in Liferay

Does anyone have any information on how to properly run a Sencha Architect MVC app in LifeRay?
Designing, and running an app using architect(in a simple local apache server for mock up purposes) seems to work perfectly. My problem is trying to convert this over to use our LifeRay portal(ver 6)
I have tried to use Senchas build tools to create a jsb and build all into one JS script, but that seems to be missing required classes, and it says it is missing files,
"NetworkError: 404 Not Found - htp://localhost:8080/web/www/senchaTest/view/MainViewport.js?_dc=1350398599155".
I have been searching for good info on how to run a Sencha MVC app in liferay, with the proper setups, but have not found any information out there.
Can anyone point me in the correct direction?
All the application which follow the JSR-286 standard can be intergated with liferay,does your application follow the JSR-286 standards?