I simply want to create api for login . no signup is there, username and password is already there in database. simply want to get username and password from front end and , i have to check with existing database, whether username and password matching, then i have to send some success message or token, what ever it be.
font end side is angularjs. and in angularjs im using
$http.post("/api address",usedata).success(data,success){}
like that but i have no idea how to do it in backend side. anyone please help.....
what i have tried with oddo is given below.
var express = require('express');
var app = express();
var fs = require("fs");
var Odoo = require('node-odoo');
var odoo = new Odoo({
host: '192.168.1.121',
port: 8091,
database: 'oaveg_demo',
username: 'dkashyap@oaveg.com',
password: 'abcd@1234'
});
app.get('/api/userdetails',function(req, res) {
odoo.connect(function(err) {
if (err) {
return console.log(err);
}
odoo.get('res.users', 14, function(err, partner) {
if (err) {
return console.log(err);
}
var userData = {};
userData.name = partner.display_name;
userData.email = partner.email;
userData.id = partner.id;
userData.password = partner.password;
console.log('PARTNER GET====> ', userData);
});
var params = [['login','=','aritha@oaveg.com'],['password' , '=' , '']];
odoo.search('res.users', params, function(err, partner) {
if (err) {
return console.log(err);
}
console.log('PARTNER SEARCH===> ', partner);
})
});
});
app.listen(3001);