mean-stack

Express has no method configure error

倾然丶 夕夏残阳落幕 提交于 2019-12-20 10:25:41
问题 I'm trying to get started with the MEAN stack. And I'm following this tutorial: link I have made it until the Test Our Server section. Here // modules ================================================= var express = require('express'); var app = express(); var mongoose= require('mongoose'); // configuration =========================================== // config files var db = require('./config/db'); var port = process.env.PORT || 8080; // set our port mongoose.connect(db.url); // connect to our

Express.js or angular for handling routes in a MEAN application?

孤街醉人 提交于 2019-12-20 08:32:19
问题 I am totally new to everything Nodejs/express/angular, and I just ran into a question that bothers me. When you have a MEAN stack, it seems that routes can be handled by both Express.js and Angular . Angular : For instance, if I define a route in Angular, I can do it like this: var app = angular.module("app", []).config(function($routeProvider) { $routeProvider.when('/login', { templateUrl: '/templates/login.html', controller: 'LoginController' }); $routeProvider.when('/front', { templateUrl:

How to Limit REST API to User-Specific Content

删除回忆录丶 提交于 2019-12-20 04:16:14
问题 I have a fairly simple API setup on a MEAN stack using PassportJS. I have no problems setting up my routes with no security (grabbing general data) and with user authentication (secure information). However, I cannot seem to find a best practices for granted user-based access. For example: /api/users/:id is a route that requires authentication. So you can never get user information without an access token. However, once I have a token, I can simply send that with a request and someone ELSE's

MEAN - Angular routes over-riding NodeJS routes

邮差的信 提交于 2019-12-19 11:48:27
问题 I'm trying to restrict access to the Client side Angular app via PassportJS. Basically i'm trying to route anyone trying to access the app to redirect to the authentication provider to login. But it appears the angular routes override the NodeJS Express routes. So if i go to '/' it'll just load the angular app and not redirect them. This is the same case for every route that uses the same route as the angular routes. server.js snippet: The following code should redirect everyone to log into

MEANJS : 413 (Request Entity Too Large)

▼魔方 西西 提交于 2019-12-19 05:16:54
问题 I am using a MEANJS stack, I upload an image using ng-flow and save the imgsrc as base64 url. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARkAAACzCAYAAAC94GgrA.... Here is my mongoose schema: var ServiceSchema = new mongoose.Schema({ name : String, url: String, description : String, category : String, imgsrc: String }); I run into a Request Entity Too Large server error for large images. I could resize the image prior to upload but this still only allows me image of size 200 x 200 $scope

Pass API data from one component into another component?

人盡茶涼 提交于 2019-12-17 13:11:11
问题 I am learning Full-stack Angular4, and wanted to know how would I be able to get data from a get call from one component into another so I can relay the data into the html page with {{data.name}}? I tried importing the component into the other component, then setting an empty object into that component.data which holds the data, but I get a empty object as a response back. What am I doing wrong? UPDATE: my shared service: import {Injectable} from "@angular/core"; import {Http, Response,

Pass API data from one component into another component?

不打扰是莪最后的温柔 提交于 2019-12-17 13:10:41
问题 I am learning Full-stack Angular4, and wanted to know how would I be able to get data from a get call from one component into another so I can relay the data into the html page with {{data.name}}? I tried importing the component into the other component, then setting an empty object into that component.data which holds the data, but I get a empty object as a response back. What am I doing wrong? UPDATE: my shared service: import {Injectable} from "@angular/core"; import {Http, Response,

Pass API data from one component into another component?

爱⌒轻易说出口 提交于 2019-12-17 13:10:10
问题 I am learning Full-stack Angular4, and wanted to know how would I be able to get data from a get call from one component into another so I can relay the data into the html page with {{data.name}}? I tried importing the component into the other component, then setting an empty object into that component.data which holds the data, but I get a empty object as a response back. What am I doing wrong? UPDATE: my shared service: import {Injectable} from "@angular/core"; import {Http, Response,

Npm install cannot find module 'semver'

自闭症网瘾萝莉.ら 提交于 2019-12-17 08:01:26
问题 I can't use npm install using the command prompt in NodeJS. I'm getting these errors when running npm install : module.js:339 throw err; ^ Error: Cannot find module 'semver' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\l ib\config\defaults.js:6:14) at Module._compile (module.js:435:26) at Object

Npm install cannot find module 'semver'

风格不统一 提交于 2019-12-17 08:01:11
问题 I can't use npm install using the command prompt in NodeJS. I'm getting these errors when running npm install : module.js:339 throw err; ^ Error: Cannot find module 'semver' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\l ib\config\defaults.js:6:14) at Module._compile (module.js:435:26) at Object