angular-ui / ui-select2

AngularJS wrapper for select2 (deprecated, use angular-ui/ui-select)
https://github.com/angular-ui/ui-select
MIT License
595 stars 444 forks source link

calling server side code from client side in Mean JS #282

Closed scvsavsa closed 9 years ago

scvsavsa commented 9 years ago

i have a code to send activation link in Server.js....and i want to call it from client side Javascript file ...here is the code

var express=require('express'); var nodemailer = require('nodemailer'); var app=express(); / Here we are configuring our SMTP Server details. STMP is mail server which is responsible for sending and recieving email. / var smtpTransport = nodemailer.createTransport('SMTP',{ service: 'Gmail', auth: { user: '', pass: '' } }); var rand,mailOptions,host,link

app.get('/send',function(req,res){ console.log('Hola!!'); rand=Math.floor((Math.random() * 100) + 54); host=req.get('host'); link='http://'+req.get('host')+'/verify?id='+rand; mailOptions={ to : req.query.to, subject : 'Please confirm your Email account', html : 'Hello,
Please Click on the link to verify your email.
Click here to verify' }; console.log(mailOptions); smtpTransport.sendMail(mailOptions, function(error, response){ if(error){ console.log(error); res.end('error'); }else{ console.log('Message sent: ' + response.message); res.end('sent'); } }); });

app.get('/verify',function(req,res){ console.log(req.protocol+':/'+req.get('host')); if((req.protocol+'://'+req.get('host'))===('http://'+host)) { console.log('Domain is matched. Information is from Authentic email'); if(req.query.id===rand) { console.log('email is verified'); res.end('

Email '+mailOptions.email+' is been Successfully verified'); } else { console.log('email is not verified'); res.end('

Bad Request

'); } } else { res.end('

Request is from unknown source'); } });

how to route from client side javascript to this server side javascript file

PowerKiKi commented 9 years ago

This project is deprecated. Fixes and new features are very unlikely to happen. You should instead consider a migration to ui-select.