What you are trying to achieve turns your device into a server.
The server language on the server must remain on the server. I really don't understand why you need to open the localhost socket on the device to communicate with itself. Is it for offline testing? You can do this because you have a computer and a device, and both are connected to the same network. I believe that understanding the concept of Client-Server architecture in the first place would be a really good start.
But, in short, the appropriate way to implement the Client-Server application using the technologies you have chosen would be: The server must provide the client with answers to its requests. So in Node.js (server side) write everything you want to contact your database (create, read, update, delete), do user processing, etc ... and return a structured answer.
The client expects responses to its requests and must process the responses in code. Thus, a program written in AngularJS (which is your client-side language) will be installed on the devices.
The client must know the server response format. Is this plain text? XML? JSON? ...
Boudini Mar 19 '15 at 13:51 2015-03-19 13:51
source share