Search Posts

Category: node.js

How To Mange Role based access control using postgres,nodejs,angularjs,express (PEAN.JS)?

I am able to login successfully, but how to use session and catch user id,name,roles that are stored in postgres database and send it to angularjs to authenticate the user based on their roles and restrict page which is only for admin. versions-> nodejs – 6.11.2, angularjs – 1.2, postgres – 9.5, express – 4.15 app.post(‘*/login-check’, function (request, response) { console.log(request.body) var uid = request.body.username; console.log(uid); db.one(‘SELECT passwrd,email,user_role FROM mtcpl_user_profile WHERE uid = $1’, [uid]) […]

Paypal integration using api of node Express framework in electron 1.7.5

Hello frontend developers,i am new in electron multiple platform technology and struck at paypal integration. My exact question is that i have developed desktop app with Electron 1.7.5 version, Express 4.15.3 for Api and Angular as frontend. please suggest me any solution for payment gateway. right now i am working to follow one blog: http://www.iamrohit.in/how-to-integrate-paypal-payment-gateway-in-nodejs/ Source: AngularJS

Socket.io which is in my Angularjs controller, is duplicated every time I access to the controller

I have an app with Node.js, Angularjs and Socket.io, I have a controller for maps.html that receives events from other clients by socket.io like that: app.controller(‘mapCtrl’, function ($scope, $http, socket) { vm = this; //…. socket.on(‘finalizarRuta’, function(data) { //Other function from the controller vm.funciones.almacenarHistorialFinalRuta(); }); }); All work good but, when Im going to other page, and later I return to maps.html, I reactive the controller and the Socket.IO functions are activated 2 or more […]

Angular with Nodemailer app & routes not linking on form submit /POST

I have not used Node/Express in well over a year so I am a bit rusty. I have followed many other examples on setting up an Angular form to sent a /POST request which then uses the nodemailer sendMail() method. When I click on submit on my form, nothing happens, but the Angular controller gets a 200 response. server.js: var express = require(‘express’); var app = express(); var port = 9000; var apiRoutes = require(‘./app/routes.js’); […]

Excel data extraction using SheetJS/js-xlsx and its usage in AngularJS

I want to extract xlsx data and display onto my webpage. I have used SheetJS/js-xlsx for extraction of data from XL sheet. Data is successfully getting extraced but I am not sure how to get this data into AngularJS for further usage. /* set up XMLHttpRequest */ var url = “test.xlsx”; var oReq = new XMLHttpRequest(); oReq.open(“GET”, url, true); oReq.responseType = “arraybuffer”; oReq.onload = function(e) { var arraybuffer = oReq.response; /* convert data to binary […]

What is ‘API first architecture’ in modern web application

I try to understand the API first architecture to apply on web application, and found some info here, Advantages of a separate REST backend API? Below I attach an example for better answer of the questions. I start using Angular.js for front-end. Node.js, Express.js for server. folder structure |– server.js |– app |– models |– views |– index.html |– about.html |– contact.html |– controllers |– app.js |– node-modules app folder is a MVC structure for […]

Moving from systemjs to webpack with bootstrap entry

I’m trying to do some examples from the “Mean Web Development” book, when it goes into Angular the code doesn’t properly load into a browser. One of the things I’m trying to do in order to solve the issue is to move from systemjs to webpack. Now, when I run the code with systemjs – it produced *.js extension file for every file with *.ts extension. My first question – Does webpack suppose to do […]

How can I include data from another collection in my mongoose object?

I am building an app with mongoDB and NodeJS with an Angular front end. I currently have users creating listings and then other users responding with bids within those listings, but want to include data of those responders. I am having a hard time including that user data in the bid create function and not sure why its not pulling. Here is the listing schema var mongoose = require(“mongoose”); var Schema = mongoose.Schema; var Bid […]

Next Page »