Add angular2 into existing nodejs app [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I was given an existing big ass nodejs app which contains both the UI and the back-end logic. I would like to split them up and am thinking of using AngularJS 2 for the UI part.
I have gone through some of the examples and know my way around Angular. However I do not know how to properly install it on the existing nodejs app - what do I include in the package.json .... what do I do with the systemjs.config.js, tsconfig.js and typing.json ? How to include the "typescript" parsing/compilation ?
Thank you
P.S. the nodejs app is running sailsJS framework.

I think you need to split the app into 2 layers (assuming this is possible):
1) the REST service layer
2) the Angular2 Front End layer
Node.js (maybe with the help of express) would run the REST service piece.
Angular2 would be the Front End part, calling the REST services offered by the Node server.
In such a scenario you would not have to 'install' Angular2 on Node. You rather would have to prepare a development environment (I suggest to use also Angular2 CLI) for Angular and start the development against the available services. Unfortunately these means that it may be difficult for you to reuse whatever pure FE logic has been developed so far (maybe with the exception of the css part).
I hope this helps

Related

Using react in a legacy jquery + java spring project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Backstory: My boss has given me the mission to figure out how to implement react into one of our existing codebases. The idea is to use this to test integration and see if we can slowly migrate out projects over to react. As well to demonstrate to those in charge improvement react can offer over jquery. The problem is I only have less than 2 years of web experience most of which is jquery and near zero of that is react. So I'm struggling to learn the process of integrating react. This is made more challenging by figuring out supporting systems like webpack, npm, and varies libs used with react.
Goal-1: Get a single page running react inside an existing layout that can support modules/libs
Goal-2: Get this page to play well with our jquery menu (option as I can rewrite it)
Goal-3: Get everything placed into its respective folders inside our src/main/webapp
Current state: I have a page loading react and babel using simple script tags. This works but is rather difficult getting any other react libs to load. As most assume npm is being used or commonjs at the minimal. Neither of these I have much knowledge with using/implementing.
What I need: Some guidance on how to implement react into an existing project. I've run over a few articles talking about the process but many lack details needed to understand what is going on in each step. For example getting webpack to export into the target directory so it can be bundled for use in tomcat.
Before this ends up closed, my high level thoughts is get your spring project into a state where it is exposing RESTful endpoints for getting and saving your data. Then build the react project separately from the current java or jquery projects, and have the react ui consume those REST apis.
Apart from that, this is a very broad question you are asking, with lots of ways to solve it, the above mentioned is only a starting point. I couldnt possibly go into complete architecture here..

Web applications with javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Now I program all my web apps with Flask or Django. (blogs, social networks...). I need templates, db access, controllers, routing...
Now I want to do same web applications, but with javascript.
People tell me : You need NodeJs for server-side, Angular for the front, and for example firebase or mongodb. Or also you can use Express JS.
But can I just use Angular JS and Firebase for start a big web app ? Need I Node if Angular can Access/Update/Delete in my db ?
Angular is a client-side framework, so you'll have to at least have some web server to serve your static files. Other than that, if you're using Firebase, you wouldn't technically need any server-side code to handle your logic - but naturally, that depends strongly on what data your application deals with.
If what Firebase provides, doesn't cut it for your cases though, you will need a server-side, and pretty much any web application framework would do. Node.js (using Express), PHP, ASP.NET, whatever your heart desires.
And yes, Angular works perfectly well for creating big complex web applications.

JavaScript WebApi references: where to store them? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Im new to javascript and want to start writing code as clean(correct) as possible. I use C# WebApi as backend and simple pure HTML + JavaScript project for frontend.
Up until now I stored configuration for my frontend in javascript files like this:
var serviceUri = 'http://localhost:666/api/service';
And just use them somewhere.
In real applications this should be outside any javascript files, at least in my opinion. Similar to how I do it with .NET stand-alone applications or WCF services. How I should store this kind of configuration for frontend application? What is best practises?
You do not need to specify the server location of the web api in javascript. If you just use var serviceUri = '/api/service'; it will take the current server location of your page.
And if you are using static files the problem that you have to change the service location both in the js and the web api will remain and cannot be get rid of without you implementing your own compile tools (which will be a pain in the ass to find the correct routing and so on).
In the enterprise solutions I've worked on we just deal with it. You could create a js file to have all the api endpoints in one place but this could easly get ugly when there are to many.

Build a Task Management App using Javascript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am looking to build a Order Management and Task Management App for my company. I am a beginner in Programming and know only Javascript (Can manage with HTML and CSS ) . This app would also require to connect with a database. Is it possible to build it only using Javascript (without the use of any other languages like PHP etc) and is it advisable. Is there any other more feasible solution.
If Javascript will suffice, a few more queries in the same line
What database would be the best to use ?
Would using Angular JS help ?
How do I search and use if theres a similar project in Github that runs only on Javascript ?
suggest you read more about the MEAN stack, it's a very popular stack that let you build the whole stack (DB, Server side logic, Client Side logic) with Javascript alone.
in short:
MongoDB, a NoSQL database
Express.js, a web application framework that runs on Node.js
Angular.js, a JavaScript MVC framework that runs in browser JavaScript engines
Node.js, an execution environment for event-driven server-side and networking applications
using the angular JS is optional in my opinion, it is required if you want to make it to feel as single page app.
try this on github, an example for MEAN stack.
You have to Choose
Nodejs Server (Javascript)
AngularJS Client (Javascript )
Mysql Backend
They are More Flexible with friendly Solutions
You could build and host your app on something like https://firebase.google.com/ - build the entire thing in eg polymer and let google host it, that way you'd be building the thing entirely in JS, no other language required

Should I have one big angular file for my entire website? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm building a website that will have facebook-ish features (friends and what not) along with a marketplace and some forums. I've decided to use bootstrap as I'm not a good designer and rather than using Jquery I've come across a replacement for their plugins written in angular (UI bootstrap is the name).
Should I just have one giant angular file for my entire website, aka the plugins for UI one and add whatever else I need to do that, or should I load in two different files? One will be the pre-written plugins and the other one will be the web app needed for that page (for example having the marketplace web app in its own file and include both of them on the same page).
This is my first website so I'm trying to make it as efficient as possible, thanks for the input!
I'd do one for the scripts that you wrote and another for the vendor scripts.
But if you are starting new to gulp or grunt you should really consider using a scaffolding tool such as yeoman. If you use angular-fullstack generator you will see some good examples for both angular and grunt, as well as node.
Definitely not, you should only have one angular component per file. Working with a scaffolding tool such as Yeoman or Slush will make this much easier.
Additionally, I would recommend reading some of the AngularJS styleguides out there. John Papa's guide and Todd Motto's guide are good places to start. Here's a full list of AngularJS resources to get you started. Good luck!

Categories