scaffolding - Is there any alternative to angular-cli for service generation? - soa

I'm looking for a generic scaffolding tool (JS or Python code output) like yeoman, that supports service generation feature like in angular-cli (ng g s myservice).
Any idea?

You should have a look at Telosys : http://www.telosys.org/
This tool is designed to scaffold very quickly. It uses simple/light text model (DSL) with customizable templates (based on Velocity).
It can generate code for any kind of languages and you can create your own templates.
For JS with NodeJS you can try this set of templates: https://github.com/so-technology-watch/telosys-templates-nodejs
For Python you can use the following templates :
Python REST with Bottle : https://github.com/telosys-templates-v3/python-web-rest-bottle
Python persistence with SQL alchemy : https://github.com/telosys-templates-v3/python-persistence-sqlalchemy
You can also generate PostMan scripts for REST tests with: https://github.com/telosys-templates-v3/web-rest-postman

Related

bundle optimization in distributed software architecture

We have an architecture where one big application is split into multiple Angular applications maintained by different teams with different deploy schedules.
These separate Angular applications in an ASP.NET context are deployed on a server and run as one big application.
Every application is deployed on a separate app pool and they all have the same layout and framework code.
Each application would use a bundle optimized by using the AOT compiler and a module bundler (rollup or webpack 2).
Each application would also use centralized JavaScript code which needs to be centralized in the big application (framework code). This code would also use Angular components and contain things such as a centralized layout component, multiple angular services making web API calls, etc...
So each application would use this same frameworke code.
The goal is also that when a change occurs to that framework code no single application would have to update and deploy again.
The standard way that I see is that es2015 imports are used and that a module bundler interprets the imports and only adds the necessary code into the module (tree shaking). Mostly the Angular framework stuff that you need is also included in the bundle (no use of CDN).
But in this case there are 3 parties delivering code:
Angular and other vendor code
The centralized custom-made framework code used through all applications also using Angular and also providing a bundle
The application itself providing one bundle
How would you go about to split and optimize the bundles?
Make a separate bundle with all Angular/vendor stuff that the centralized framework code and the application need to use
Angular stuff would be excluded from the main bundle
Use a CDN-like way to centralize the custom framework stuff and referencing that bundle (without angular code in the bundle)
So you would end up with something like this:
<script src="vendor-bundle.js"></script>
<script src="/central-location/frameworking-bundle.js"></script>
<script src="app-bundle.js">/script>;
What is the best approach in this specific case? I cannot find good examples for this kind of architecture setup.
Just use this kind of construction:
<script src="vendor-bundle.js"></script>
<script src="/central-location/frameworking-bundle.js"></script>
<script src="app-bundle.js">/script>;
And use eTags/last modified caching on the frameworking-bundle.js
This way the file is downloaded again if modified.
Users will always get latest version without using versions/hashing/query string. It won't have to do modifications to the code.
https://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/
The frameworking code should exclude the vendor code and the application should define it. In the same way that for example Kendo requires you to have JQuery.

Is there a way to generate an ASP.NET 4 server using Swagger

Looking at the output targets for swagger-codegen, I can only see options to generate aspnetcore- and aspnet5 servers, the latter being deprecated. Is there a way to generate a server that results in an ASP.NET 4 solution, preferably in a way that would allow me to "include" the generated code in an existing MVC application?
You may want to try Swagger Codegen v2.1.6 stable release: https://github.com/swagger-api/swagger-codegen/releases/tag/v2.1.6 to generate aspnet5 server stub.
To make it compatible with ASP.NET4 solution, you can try customizing the templates and use the -t options with the templates customized to work with ASP.NET4

How to keep implementation and documentation in sync when using swagger 2.0 to document the REST API?

I want to use Swagger 2.0 to document REST API as this seems to be widely used to document RET APIs.
However, I am not sure how can I keep the documentation and implementation in Sync ? e.g. When I add a new API then I have to make sure that the model (to represent the Response) used in the API documentation should be same as the model created in the REST implementation. Similarly, the resource name given in the documentation should match the resource name in the implementation.
Is there a way to generate just the resource interface and model classes from the documentation produced using swagger 2.0 spec ?
You can generate server source with these tools (they can also generate client source) :
http://studio.restlet.com: online editor, generate server skeleton code for java (Jax-RS and Restlet) and Node.js
http://editor.swagger.io: online editor, generate server skeleton code for java (Jax-RS), Node.js, Scalatra and Java Spring MVC
https://github.com/swagger-api/swagger-codegen: swagger code generator, you can try to implement your own generator module (personally, I'm currently trying to use this one)

what is api-paste.ini file in openstack

I've seen api-paste.ini as a conf file after installing openstack.
It looks like substituting some prefixes for python implementation but have no clue about this.
Here, my questions are:
What script is it?
it looks like very bizarre grammar like the following:
[composite:metadata]
use = egg:Paste#urlmap
/: meta
How does it work within python script?
See documentation for Paste Deploy.
The api-paste.ini is the configuration for the above web-services framework. Paste.deploy allows you to separate concerns between writing your application and middleware/filters from the composition of them into a web service. You define you WSGI applications and any middleware filters in the configuration file then you can compose pipelines which include the middleware/filters you want into your web-service, e.g. authentication, rate-limiting, etc.
You want to temporarily remove authentication, take it out of your pipeline and restart your web service.
The declaration above is declaring a composite application, but with only one application binding (a bit unnecessary - normally you would expect to see more than one binding, e.g. for different versions of the application). The WSGI application app:meta will be bound to / and you should have a declaration of app:meta later in the file. The implementation of the composite app is declared via the use and the egg:Paste#urlmap is a simple reference implementation.
You load this in your program with paste.deploy.loadwsgi.loadapp().
There is a proposal/recommendation(?) to move away from Paste Deploy/WebOb to WSME/Pecan see OpenStack Common WSGI

Why does the Breeze/Knockout template install as a tool instead of a template making it unusable?

I am trying to use the Breeze/Knockout Template written by Ward Bell (AKA, BreezeJS MVC Template). I successfully installed the breezetemplate.VSIX extension (by running the downloaded file) into VS 2012.
However, when I inspect the Extensions and Updates (from Tools in VS 2012) the Breeze Knockout Spa Template shows up under Tools not under Templates in the dialog. I am assuming that is why when I create an ASP.NET MVC 4 Web Application, the Breeze Single Page Application does not appear in the next step when you are prompted to select a template to use. It simply does not appear in the list of available templates to use.
I wanted to install this as a sample template to see a fleshed out usage of Breeze using EF and a data-repository on the back end. I am using Hot Towel SPA as a starting point, but it really doesn't have any Breeze code.
I added in a simple Breeze DataContext to the Hot Towel Spa template based on the Breeze.WebApi NuGet packages written by Jay Traband. Using that I was able to modify my project to use EF backed by a SQL database instead of a pseudo-database as used in the Breeze.WebApi example.
However, it looks like the Breeze/Knockout template written by Ward Bell is a more sophisticated example. I need this more sophisticated sample to server as an example for how I want to use Breeze.
So after a long explanation here is what I am asking:
1) How can I get the Breeze/Knockout template to install as a template instead of as a tool in the VS 2012 Extensions and Updates?
2) If there isn't an answer to 1), is there somewhere where I download a VS 2012 project based on the Breeze/Knockout template?
3) If the answer to 2) is no, will Ward Bell please make a simple project based on this template available via GitHub, or other public code repository (NuGet Please!).
4) Is there some other non-trivial example of Breeze using EF and a data repository that is available to use as a reference?
You can install ASP.NET and Web Tools 2012.2 Update to get the templates

Resources