2

I have a nodejs file in the local host which connects to mysql database. My SQL database has cake table which contains name and price. I want to connect angular js to node js so that I can retrieve the name and price from the cake table.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
satheesh
  • 83
  • 2
  • 2
  • 4
  • 1
    What have you done ? If you haven't do anything, explore express. Try search express + angular. – Rudy Jul 18 '16 at 03:34

2 Answers2

1

AngularJS is normally referred to as a client-side framework, which can be run from a web browser or a native mobile app while your MySQL and NodeJS app are usually referred to as server-side application.

While both of them can be hosted in your localhost environment, you still need a communication protocol for these two components to talk and transfer data. The most common way is using HTTP, which will require you to integrate a HTTP server with your NodeJS app.

In a HTTP model, your client-side AngularJS will make a HTTP request to ther NodeJS app and wait for a HTTP response which in your case, the AngularJS asking for data from the MySQL database.

There are couple of ways to do get a HTTP Server running with your application: Using node.js as a simple web server provides really good solutions:

Community
  • 1
  • 1
Thai Duong Tran
  • 2,453
  • 12
  • 15
1

This is the most clarifing answer that i have found.

https://stackoverflow.com/a/35699700/3156756

This new app on the client thing changes some development paradigms and it is dificult to understand the big picture.

Basically you will do get/post to push and pull data. With this you can create a single api interface for diferent types of clients. browser, iphone, android, windows phone, etc

Community
  • 1
  • 1
LeoPucciBr
  • 151
  • 1
  • 10