Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

Ready login page and register page using HTML and AngularJS. I have connected database PostgreSQL, but I don't know how to pass data from AngularJS frontend to Nodejs backend using PostgreSQL.

share|improve this question
    
Sorry, it sounds like: I need make big red button "Make all done" 1. You should choose frontend and backend conversation rules. I recommend REST on backend (Express for example on Nodejs) and Angular on frontend. 2. In your controller you should create method and post data to endpoint 3. You need library to connect to PostgreSQL (hc-postgresql for example) and you should pass your data from endpoint to your database – Sabik Aug 22 at 15:47
    
Clients should never connect to your database server directly. Never. The database server is NOT for communication. Read about REST services and good old fashioned <form>s, with POST or GET parameters. – Bailey S Aug 22 at 20:31

You can do it by several ways like using
"$http" - https://docs.angularjs.org/api/ng/service/$http
or
"ngResource" - https://docs.angularjs.org/api/ngResource/service/$resource

Using these you can pass data to Node.js backend(I assume "Express.js"). Since DB data will be executed by backend you just need to post your login or registration values to back-end. Here is below is a simple $http process:

$http.post('/login', {
    email: this.email,
    password: this.password
})
.success(function(response){
    // execute your response            
});

Actually for login/registration and another security purpose I recommend using JSON Web Token (JWT). https://jwt.io/introduction/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.