Integrate Node.js with Angular 2 application - node.js

I am creating an angular 2 project which will use Node.Js as backEnd and Node.Js will make calls to 3rd party external APIS(Like Gandi) which accept calls only from Python, PHP or Node.Js.
I have chosen Node.Js.
I have called few APIs from Angular 2 services using HTTP protocol. Now I do not know where to write this Node.Js code and how to Integrate this Node.Js code with Angular 2 services.
I think, Just a sample application or sample architecture which is a combination of Node.Js and Angular 2 will help a lot.
Do I need to create Restful services using Node.Js?
If Yes, Do I need to use Express.Js also for server purpose?
Note: I do not want a Mean Stack application(No Mongo DB)

Actually it's pretty straightforward.
What I'd do is to simply consider the Angular 2 app on the frontend and the Node.Js API on the backend as independent projects. It's very likely that they will run on different providers (eg. Firebase for Angular 2 app and Heroku for the Node.js server) so it makes sense to handle them as 2 different projects with it's unique dependencies.
I have recently done a similar project, using Angular 2 + webpack as frontend and Django on the backend: https://github.com/damnko/angular2-django-movies
Hope this makes sense, otherwise please let me know

i think this repo will serve your purpose.
https://github.com/singh15/feed-server
which is using twitter api to get data and send that data to any front-end.

Related

Do I need Node.js or Express to deploy my Angular 2 app?

I am working on a food purchase web app. The app has already been launched on mobile (Android). Now we want to build a web version.
The backend of this app was built using Node, Angular and Firebase.
I would like to know if I can only use Angular 2 (without Node.js) for the web application. What the web app will basically do is to:
User authentication
Consume Backend API
Checkout, after purchase
My major concern is, do I need Node.js for anything? Or is Angular 2 just enough for my frontend development and deployment?
Angular is your front end.
Nodejs is your backend.
Firebase is a cloud backend that I assume you're handling your user Authentication in....it's easier than DIY if you aren't backend savvy.
Depending on what Node is doing, then you might be able to remove node and rely entirely on Firebase(big maybe...).....I suggest not touching anything becuase you clearly aren't a backend engineer. Node is probably hosting your app's API and/or connecting to your database.
Yes, you can switch to a different backend from node like PHP or .Net and it will work with Angular2. You will need some sort of backend(Angular2 is 100% front End).

Lumen (Laravel) V.S NODE.JS Solutions

i need to develop an API backend that it should be :
robust
high performance
provides RESTFULL API
connected to a Mysql storage: i prefer a relation db for the
complexity
only backend not also frontend framework
I'm undecided between :
Lumen : i need only API service because i choose react js as frontend framework.. so i think is better lumen than laravel because i no need frontend
Nodejs api solution: In this moment searching on the web i found Seals and Loopback as framework for my api backend.
I find discortanti opinions ... some told that php solution as Lumen is not good for performance ( see http://www.infoworld.com/article/2866712/php/php-vs-node-js-an-epic-battle-for-developer-mind-share.html ).... and some one told that in this moment there arent reliable api backend framework in node js: seals is not good for performance and about loopback i found few comment... so i ask you what is the best choiche for performance and robust solution ..
I'd recommend Loopback. It has been acquired by IBM so you can expect continued improvement and stability.
If you think about JavaScript for client and server side then you can choose node.js with sails.js framework which is follow full MVC structure. If you use sails.js, you don't need to be expert in node.js. It's easy like other PHP framework like Laravel. For database you can use MongoDB. To work with different types of API include angular.js also. So finally your platform dependencies are:
1. Node.js (Server Side Coding)
2. Sails.js (For Maintain MVC Structure)
3. Angular.js (For Managing Frontend, HTTP request API etc)
4. MongoDB (For Database)
So that you will find out everything require your working development dependency. I think this will help for you.
Thank You :)

using Angular 2 application with express-node js api

Hi i am trying to understand the installation of Angular JS v2. I have read a lot of tutorials and right now i am very confused some are using webpack to create server and using the application, in some examples they use generators and all the generated files are in TypeScript then.
I just want to use Angular JS as frontEnd and express app as an API (RESTFUL) but i don't know how to configure it. Do i have to create two different servers for it or can i use same express server to serve index.html of angular 2 application.
Kindly provide your suggestions, any tutorial link or any direction where i should dig in. Any help will be appreciated.
Thanks
You need a frontend server that is running Angular2 and a NodeJS backend server that your frontend makes HTTP requests to.
To get an Angular2 server up and running either use the Angular2 quickstart project (as referred to throughout the Angular2 docs) or use Angular CLI (this is an npm package). The Angular2 docs use SystemJS. Angular CLI uses Webpack.
For your backend server, use expressJS (another npm package).
First step for you is to install NodeJS !!! :)

Do we need Node.js and Express.js while working with Angular2?

I built a sample web application using the following -
Angular 2
TypeScript
ASP.Net WebAPI 2
Mongo DB
Karma/Jasmine
Node.js (only as a server, just to the extent as specified in Angular2 Quick Start)
Considering the above tech stack do we have any need of using Node.js or Express.js for building a production web application? Is any of the above tech is replaceable with Node/Express, for better performance/memory utilization/code maintainability/faster development?
You'll need Node.js for development time tooling - for instance, TypeScript compiler and running Karma/Jasmine tests.
Regarding Express.js - you can do without it. An Angular 2 application does not rely on a back end framework. It could be served as static assets from a web server. Pick any back end framework that suits your needs.

node.js server for ionic application

I am developing a mobile application using ionic framework. I want to use node.js for developing the server to make REST api calls.
Where should the node.js code be included in the project?
How to deploy such an app as apk? and how to test it?
Ionic is based on cordova and it is used to create mobile applications in javascript.
Node.js is based on V8 and it is used to create backend (server) applications in javascript.
Node.js code cannot run on mobiles.
So you have two seperate projects.One is the frontend ionic mobile app. And the second is the backend nodejs app.
To make a connection between the two, as ionic uses angularjs take a look at angular's http service. After that you can organize your code in services. For example:
http_calls_service.js or api_service.js
As for the testing there are several frameworks to work with. Take a look at this.

Resources