Get Django sessions on Node.js -


i'm trying add node.js web application in django have real time. i'm doing functionality of "like" in facebook, when users click "like" ajax post id of song domain.com:3000 (node.js server).

i have user id on session variable, don't know how access session variable node.js.

here code:

node.js

var express = require('express');  var app = express();  app.use(express.static('./public')); app.use(express.bodyparser()); app.use(express.cookieparser());  app.get('/', function(req, res){     res.send("id user: " + req.session.user_id); });  app.listen(3000); console.log("working under 3000") 

django

def auth(request):     if request.is_ajax() , request.method == 'post':         email = request.post.get('username', '')         password = request.post.get('password', '')         autenti = jayapalbackend()         auth = autenti.authenticate(email, password)          if auth not none:             id_usuario = usuario.objects.get(email=email).getid()             request.session['user_id'] = id_usuario             return httpresponse('1')         else:             return httpresponse("-1")     else:         return httpresponse("-1")    

thanks

edited:

i error:

typeerror: cannot read property 'user_id' of undefined 


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -