I am trying to make an spring MVC based application with google polymer in front end.I am novice in google polymer
Can anyone help me with the project structure, where and how to arrange the polymer library?
So after some readings, i found the answer, might be useful to others
The UI application build in Polymer is single page application which consumes web services form another application in spring (could be anything else)
the two applications deployed separately , there is no need to bundle these together, instead these shouldn't be.
Related
I'm trying to figure out the best way to integrate a front-end angular application with .net core back end API.
I've already seen two different methods and wondering why use one over the other?
Use the ASP.NET Core with Angular project template (within visual studio) + ASP.NET Core Web API project template.
Use a basic stand alone Angular application + ASP.NET Core Web API project template.
Any thoughts or information is much appreciated!
The Angular project template offers the convenience of managing the two apps (API backend and Angular frontend) as a single unit in one solution, and the project can be built and deployed as a single unit.
If you'd like to create and build the backend and Angular frontend apps separately, and host them on different server or sites, or you just want to create an Angular frontend to consume an existing API(s) backend, you can use Angular CLI to create a customized client app without using the Angular project template.
It's actually very good question, i used to create a stand alone both of front-end and backend parts and work with them separatly. It's makes me able to think only about that part or about only that feature i'm working on whatever it is.
I have created a server-side rendering react app using .net core (which is already given by .net core).
I want to have more than one react app inside .net core app.
I didn't get any related links to it.
Please help me with this.
Thanks
You can use webpack to make multiple react builds from different react projects. Then when you use SSR in your .net core controllers, you can set different views using multiple view layouts or just views, each targeting a different react app. - Of course you'll need to dig deeper since what you are asking is a lot of setup and coding but this is one possible solution.
Write your react apps / if you are using create-react-app, use the 'eject' feature to get the hidden files so you can expand on them.
Use one Webpack config to make separate builds
Make multiple controllers with SSR or one that selectively issues view pages based on your use case - SPA Services SSR is gone in .net core 5, you can still use core 3.1 or there are many libs in the works and require some reworking your startup setup and controller
Add View pages or Razor pages targeting the react app
This is not the only way but will get you going with the least amount of fuss.
Webpack is the key here, hope this helps you in the right direction.
I currently have a Play project where Angular Front-end is integrated into it with Gulp. Now I need to re-use the angular code into a .Net Web-Api project. Having APP and API as separate project will work. But to avoid dealing with different ports and CORS only option is to have one project that is deployed to one port where AngularJs project gets integrated along with Web Api project.
I have checked many question only this Stack-overflow answer seems relatable to my scenario but no luck with that solution too.
Does anyone know how to do that kind of integration. And is it possible to have integrated both into one project
Create ASP.NET MVC application.
Change default Index.cshtml with your index.html from Angular application. (You'll maybe need to correct paths to other files).
Now ASP.NET runs your application so you can add WebAPI Controllers instead of MVC Controllers inherit from ApiController.
I am new in Asp.net Core and trying to clear my concept on web api. I have basic knowledge on web api. I can do CRUD operation using web api by running that web api project and calling it in other web application project at a time.
My problem is,
I add an web api in a web application project named "Api_BusinessUnit".
How can I call this web api in a controller named "BusinessUnitController" shown in below image. My confusion is, Both are in a same project, I can run one project at a time. So how can I use this web api in "BusinessUnitController" ?
Thanks in advance.
Why do you want to have one Web API call another in the same project? If you need to communicate between parts of your project, you can do so directly without having to over the web, which will be much better from a performance perspective and will be more reliable as well.
That said, looking at your image, I think you have two separate web projects in the same solution which isn't the same thing at all (you may wish to update your question if this is the case). To have one project communicate with the other project, you should determine the URL of the destination project and call it as you are doing. You also will need to ensure both projects are running, of course. You can launch multiple projects at once when you hit F5/ctrl+F5 as shown here:
http://ardalis.com/how-to-start-multiple-projects-in-visual-studio
For me, I am a Scott Allen fan and he explains the project structure for the particular structure you are trying to create here.
https://odetocode.com/blogs/scott/archive/2013/07/01/on-the-coexistence-of-asp-net-mvc-and-webapi.aspx
However, I am a fan of best practices and SoC, so the proper way, IMHO, is to have one solution with multiple projects and either keep the entire solution in version control, or have the project solutions separate, build and deploy to a directory will all of them for testing.
Then the key factor to running MVC and WebApi as different projects in the same solution, besides making sure that Microsoft.AspNet.WebApi.Core is installed, is that the start up project is the MVC and the WebApi references that MVC. Then you're off to the races.
We are a small dev team that has inherited a decent sized ASP.NET MVC project started a few years ago with ASP.NET 4. We are looking to migrate to ASP.NET 5 at some point. Currently the solution has 3 projects - Data, Services, Web. The data project uses the Entity Framework. The Web project previously was just MVC but now houses a Web API where we have a couple hundred RESTful API calls and an AngularJS frontend.
It looks like the ASP.NET 5 default solutions for web applications uses a new structure with the web project containing wwwroot and other things. Would you recommend having multiple projects or should we keep the data and services in the main project? I'm leaning towards the single project approach, but I'm unsure what the best long term structure would be. Thanks!
One solution, many projects. The point is to separate reusable components of your project. In fact, I'd add one more project to the ones you listed in your question. Models.
Let's say you decide to add another application to your solution. It might be a Xamarin Forms app, a WPF app, console app, Windows service, whatever. If your Models and Data Layer are each in their own class library, you can reuse them without needing to duplicate code. If you had put your models and data layer in your Web API project, you wouldn't be able to reuse it in your new app easily.
The only thing that I wouldn't necessarily (thought I still might) combine is the Web API app and the Angular app. Those two are probably so intricate that it makes sense to keep them in one project.