mean-stack

Javascript delete object property not working

旧巷老猫 提交于 2019-12-03 19:56:06
问题 I'm running some project on MEAN.js and I've got a following problem. I want to make some user's profile calculation and the save it to database. But there's a problem with method in users model: UserSchema.pre('save', function(next) { if (this.password && this.password.length > 6) { this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64'); this.password = this.hashPassword(this.password); } next(); }); If I will send a password with my changes, it will change credentials,

Extending the users package of mean.io

自作多情 提交于 2019-12-03 16:54:58
I am trying to create an application for sports event management system using MEAN.io Since it uses the modular approach, there are different packages that comes in skeleton application like system , users , access . What i want to do is make a new package called players and it should extend the users package. The players schema would contain extra fields section and teams .So how do I extend the User Schema of users package in players package? You can make your players package be dependent on users. Players.register(function(app, auth, users, database) {...}); You now have access to the

AngularJS ui-router : Could not resolve___ from state ___ Error

微笑、不失礼 提交于 2019-12-03 14:41:13
问题 I am following along on this year old ui-router tutorial http://txt.fliglio.com/2013/05/angularjs-state-management-with-ui-router/ and I'm getting the following error: Error: Could not resolve 'settings/quotes' from state 'settings' I am fitting this tutorial app into my Express.JS setup and I'm using Jade for my templates. All the Jade templates seem to be rendering properly but I am noticing that there is no href being created for the User Quotes ( settings/quotes URL) ui-sref link. Maybe

How to use socket.io with the latest mean.io?

試著忘記壹切 提交于 2019-12-03 14:38:28
I have fetched a copy of the latest Mean.io and noted quite a number of changes compared to the previous version I have been working with before. Now, what I am doing is creating a very basic chat application that uses socket.io with rooms. Following the basic setup in the Socket documentation I have to implement the following: var app = require('express')() , server = require('http').createServer(app) , io = require('socket.io').listen(server); server.listen(80); app.get('/', function (req, res) { res.sendfile(__dirname + '/index.html'); }); io.sockets.on('connection', function (socket) {

Is JWT necessary over HTTPS communication?

巧了我就是萌 提交于 2019-12-03 14:14:54
问题 I'm developping a MEAN stack application, and I'm currently setting up an account system. I've seen several tutorials about Authentication, all using JWT . I've also seen that JWT are a great way to secure communication transport over non-secured connection like HTTP. I've set up HTTPS to communicate from my Angular 4 front-end to my NodeJS + Express back-end, and thus, wondering if JWT are necessary to secure my communications? 回答1: Nowadays developers prefer Token Based Authentication

npm install -g generator-X error in windows

倖福魔咒の 提交于 2019-12-03 14:07:12
问题 Both producing same error. npm install -g generator-angular-fullstack. npm install -g generator-meanjs. I tried everthing (googling and stackoverflow) but this problem is scratching my head from the last 3-4 hours Any support would be helpfull I tried npm install -g generator-angular-fullstack or npm install -g generator-meanjs Initially it said python required i installed latest python but again it said not compatible version i searched and found 2.7.3 is supported so I uninstall the latest

error when starting the server with grunt or node server

空扰寡人 提交于 2019-12-03 12:53:01
问题 I am trying to use the mean stack as described here : http://mean.io/ after install, when making "grunt", there is an error : debugger listening on port 5858 4 Jan 01:47:40 - [nodemon] reading ignore list Express app started on port 3000 events.js:72 throw er; // Unhandled 'error' event ^ Error: failed to connect to [localhost:27017] at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74) at EventEmitter.emit (events.js:106:17) at null.

How does Angular and Express routing work together in a mean.js app?

↘锁芯ラ 提交于 2019-12-03 12:34:21
I'm struggling about Angular and Express Routing (by the way, i'm somehow new to Express), i've been handling routes with Angular — with ui-router — but now that i'm starting to build a MEAN.js Application i notice that i can handle server-side routing and client-side routing... and that's what makes me get confused, here are some of my questions: How are they different? If i switch to Express routing will i still have a SPA? Can i use both at same time? How? Is it good practice? Does it has any benefit? When should i use only one of them? How will i handle route parameters? etc... If someone

jQuery slider not working in angularjs

拜拜、爱过 提交于 2019-12-03 10:03:50
My slider wont come up on first time navigation of the page. However when I hard refresh the page then it comes up and also if I replace the <div ng-view></div> code with the front.html page content then also the slider starts working. Let me know what I am doing wrong in angular as I believe it is something basic that I am missing. Following is my layout code - <!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="utf-8" /> <title>WEBSITE</title> <link rel="stylesheet" href="assets/css/style.css" /> <link rel="stylesheet" href="assets/css/flexslider.css" type="text/css" media="screen" /

Expose vs Creating object in Router file of Nodejs

我怕爱的太早我们不能终老 提交于 2019-12-03 09:08:08
So, I just started with expressjs 4.0.0 and came across the express.Router() object, which is really nice. Problem is, now that all my routes are in another file, how do I expose an object to the routes file ? serverjs file: ... var passport = require('passport'); var router = require('./app/routes.js')(passport); //WILL NOT WORK app.use('/', router); app.listen(8080); routes.js file: ... var express = require('express'); var router = express.Router(); //new feature in expressjs 4.0 //routes go here module.export = router; So, how should I access passport object in router file ? Should I