• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to integrate service layer with database in Angular 2 web app and do packaging for deployment?

 
Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new Angular2 and learning it using TypeScript. I understood that everything is component in Angular2 and we do not render whole HTML page but by just specific component. I have 2 basic queries here:-

1) In my sample, Angular 2 app, I have service component class which brings static data to my component class using Dependency Injection. Instead of static, I want to bring data from my database (MongoDB). Between service layer and database, I'm quite confused. May I know what are industry best approaches to integrate service layer and database layer in a regular Angular 2 app? Do we have tightly coupled architecture like normal JAVA J2EE MVC architecture from controller to service to dao to hibernate/JDBC/ibatis or do we integrate using web services (RESTful APIs'), loose-coupled fashion?

2) Secondly, how do we package this Angular 2 web app? Do we simply zip it or export as WAR file? Currently, I'm running it on my local system using my Node.js (npm start, etc on command prompt) and using Visual Studio Code for coding? How to create WAR file and does Tomcat App server supports Angular 2 apps?

Thank you
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) After moving of from Angular 1, I've been looking into React/Redux, and so am unfamiliar with Angular 2 at this point. (That will likely change in the future, but of now...) That said, most component architectures (including React/Redux) do not recommend mixing presentation components (those that represent visual elements) with backend data details. In React/Redux, one currently popular approach is to create non-presentational "container" components that take care of data details as managed by the Redux store.

I would suggest searching for articles on the same subject for Angular 2 to see what patterns and approaches are being widely used in that arena.

2) Why would you need to serve a client-only web application from a JEE server? As there is no backend, you can serve it from any simple web server.
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic