Ionic and AngularJS and NodeJS, Oh My!

I’m new to everything HTML/JS having spent 8 years in Flex. I’m also just starting out with Angular and Ionic and am curious where NodeJS fits into all of this. Having just read this…

I’m even more confused…is ionic agnostic to NodeJS? Is there any overlap with ionic? Why not use/use NodeJS? Seems like a hot framework but have no point of reference to make a call.

Pardon my total absence of mind with these questions. Just trying to get started off on the right foot!

Hey @jfinnigan. In that article, they are using AngularJS on the frontend not the backend, so you don’t use Angular with Node at all.

So, you’ll have a server running the background processing and serving data. In this case, you’ll be using Node.js for that, which you won’t use Angular for.

Then, on the client side, you’ll use AngularJS and Ionic. Ionic provides the UI and UI interactions. Angular provides the framework for building the client-side application and sending/receiving data to your backend Node server. Ionic has features that fit into the Angular way of doing things that you’ll want to use as well to make your life much easier.

Does that help?

Hi Max,
Can I use ionic with express. I want to use RDBMS as backend datastore. I want to use express because it has got lot of plugins to communicate with RDMS such as mysql, sqlite etc. Also please do suggest if there is a way if we can drop express and get some RDMS plugin which resides on Node and angular can talk to that plugin and intern that plugin will persist data to backend datastore.


@sumit_jaju the relation is really between AngularJS and express don’t think Ionic has any relationship here. I am using Ionic/angular successfully with express, using $http of angular.

1 Like

@joyhom, thanks for reply. I wanted to say the relation between angular and express only. But I want to know if I can use node-mysql without using express? So that my communication flow would be Ionic -> Angularjs --> nodemysql – > mysql DB. Hope its clear.

Please let me know.

All in all you can build something like that:
ionic (angularjs) – Request --> NodeJS APP (serving an app and handles requests - like express framework do and connected to mysql via node-mysql).

You need a nodejs app (API) running on a specific port that handles request.
This app can be written in pure and native code on your own… or you are using a framework like express.

If i understand you correctly -> you want direct db access? But you need an API where you can send a request via $http from angular to your nodejs API and nodejs gets data out of your database.

@bengtler “you want direct db access? But you need an API where you can send a request via $http from angular to your nodejs API and nodejs gets data out of your database”. Yes this exactly what I needed. Also I need DB access directly from angular. Can I put node-mysql or anyother adapter resides on nodejs independent of express and get the data out of DB ?

Like i said… you can not get direct db access from angular.

But you can build nodejs API without express:
This article is a little bit old but describes how it could work
using nodejs “http” module.

So you send a request from your app like GET "http://APIURL/data"
You have to read the request data in your nodejs app and decide what data you want to read.

You can google such tutorials or you should learn maybe the functionality of frontend - backend communication.

There is the possibility to access “directly” a database via frontend wit some external services or frameworks:

There you get a thirdparty framework where you can store your data without an own backend and so on.
Or you could use meteorJS.

Thank you so much beng ! I really appreciate ellaborating in detail. I was successfully able create small todo app using Ionic / Angular <–> express <–> mongoose wrapped around NodeJs. Thanks much. Moving forward now :smile:

1 Like

Hello guys,

First of all, I’m noob on both ionic and nodejs so please be patient.
I have a question regarding the connection on a local host between ionic/angular and nodejs/express:

My client side is a slidemenu ionic app running for testing and developing on http://localhost:8100/#/app/ (after cmd ionic serve)
The server is a nodejs+express app running on http://localhost:8080/ with different REST api. (I use the backend for connecting with mongodb)

How do I connect the both of them? Because if a make a request from client as “api/users” I will get an connection error despite the fact that if I call it in browser (http://localhost:8080/api/user) I get the correct results.
Do I miss something?

Thank you!

Problem solved :smile:

Hi i am new to ionic i want to connect to mySql database from ionic how can i connect using node js or any one please give me details and if possible sample code

codrinf can you share me your solution?Right now we are also using mean with ionic2 but i have doubt do we need to maintain two servers one is for nodjs and one is for ionic2.I can maintain two servers and i am able to get the data too but how can i deploy this to aws?