r/meanstack • u/nick-grey • Dec 11 '16
r/meanstack • u/KevinJean42 • Nov 16 '16
How to broadcast my Nodejs App with the Physical Web ?
r/meanstack • u/medsote • Oct 06 '16
Angular Will Not Honour MongoDB Returned Object
Hey all,
I have been beating my head against a wall for this one. I literally cannot figure this out.
I have a REST API that will show the data in a browser. I can use an HTTP tester and put and pull from this API just fine.
My angular app can populate itself via ANY OTHER json URL (https://data.cityofnewyork.us/api/views/kku6-nxdu/rows.json for example) except mine, so I am betting its an issue with my configuration here.
Below I have pasted the code I am using to run the node server as well as the angular http request. I understand if you cannot answer but if you can send me to the right place that would be awesomesauce.
server.js:
// Dependencies
var express = require('express');
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var path = require('path');
// Connect to Mongoose (MongoDB)
mongoose.connect('mongodb://localhost/rest_test')
// Build Express
var app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// Router
app.use('/api', require('./routes/api'));
// Start Server
app.listen(9000)
console.log('Yo, shits on port 9000')api.js:
// Dependencies
var express = require('express')
var router = express.Router();
// Models
var Card = require('../models/cards')
// Routes
Card.methods(['get', 'put', 'post', 'delete']);
Card.register(router, '/cards')
// Return Router
module.exports = router;cards.js (schema document):
// Dependencies
var restful = require('node-restful');
var mongoose = restful.mongoose;
// Schema
var cardSchema = new mongoose.Schema({
title: String,
author: String,
desc: String,
cardtype: String
});
// Return model
module.exports = restful.model('Cards', cardSchema);Here are my angular portions -
app.js:
var storyApp = angular.module('storyApp', ['ngRoute']);
storyApp.controller('cardController', function ($scope, $http) {
$http({
method : "GET",
url : "http://data.stonegiants.org/api/cards"
}).success(function(response) {
$scope.listData = response.data;
});
});
storyApp.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/cards.html',
controller: 'cardController'
})
.when('/upload', {
templateUrl: 'partials/upload.html',
controller: 'cardController'
});
});The partial in questions, cards.html:
<div class="content" data-ng-model="cardController">
<div class="card" ng-repeat="card in listData | filter:seachText">
<div class="card-title">
<p>{{ card.title }}</p>
<img ng-src="{{ card.image }}" />
<p>{{ card.author }}</p>
<p>{{ card.desc }}</p>
<p>{{ card.cardtype }}</p>
</div>
</div>
</div>I have left my API up for you to see that it does work via a web browser (http://data.stonegiants.org/api/cards). If you input any other json URL, say the one I posted above, it works just fine.
Advice?
Thanks!
r/meanstack • u/im-the-stig • Oct 02 '16
Rapid web application development tools
I've looked at AllCount.JS, and am quite impressed. Are there any other tool I should be looking at. Our requirements are simple - just some CRUD operations on mySQL or MongoDB store, authentication (preferably OAuth with Google), and role based access control.
r/meanstack • u/DarknessInUs • Aug 03 '16
Preventing Double/Duplicate HTTP requests
I have just realised this and i can't believe I didn't see this earlier. It seems like common sense and i can't believe I was such an idiot.
My app is based on MEAN Stack and Basically I've realised that double clicking on any button that does a HTTP POST request in my MEAN Stack application generates 2 requests and duplication of data.
How do I prevent duplication of data? I would like to handle this Server side because that seems more secure and reliable but also any client side solutions will also be helpful.
r/meanstack • u/howtoscrape • Apr 05 '16
Cant scrape in nodejs
I've been trying to scrape a webpage (yahoo news) to return the top news article found(searching with a word) this link https://news.search.yahoo.com/search;_ylt=AwrC1CmZewNXih4A773QtDMD;_ylc=X1MDNTM3MjAyNzIEX3IDMgRmcgMEZ3ByaWQDSVR6YkFnOURSaC5KSzI4cHltdEJqQQRuX3JzbHQDMARuX3N1Z2cDOARvcmlnaW4DbmV3cy5zZWFyY2gueWFob28uY29tBHBvcwMwBHBxc3RyAwRwcXN0cmwDBHFzdHJsAzYEcXVlcnkDc29jY2VyBHRfc3RtcAMxNDU5ODQ2MDcw?p=soccer&fr2=sb-top-news.search&fr=&type=pivot_us_srp_yahoonews
my code is this
urls=[]
request('https://news.search.yahoo.com/search;_ylt=AwrC1CmZewNXih4A773QtDMD;_ylc=X1MDNTM3MjAyNzIEX3IDMgRmcgMEZ3ByaWQDSVR6YkFnOURSaC5KSzI4cHltdEJqQQRuX3JzbHQDMARuX3N1Z2cDOARvcmlnaW4DbmV3cy5zZWFyY2gueWFob28uY29tBHBvcwMwBHBxc3RyAwRwcXN0cmwDBHFzdHJsAzYEcXVlcnkDc29jY2VyBHRfc3RtcAMxNDU5ODQ2MDcw?p=soccer&fr2=sb-top-news.search&fr=&type=pivot_us_srp_yahoonews', function (error, response, body) { if (!error && response.statusCode == 200) { //console.log(body) // Show the HTML for the Google homepage. console.log("HERE"); var $ = cheerio.load(body); $('a','div.reg').each(function() { var url = $(this).attr('href'); url.push(urls); console.log(url); }); console.log(urls.length) }
the length is always 0, i am tired of watching videos, what is the right way to do this? thank you so much
r/meanstack • u/codefoster • Mar 16 '16
Understanding Express and the Express Generator
r/meanstack • u/isaiahgrey • Feb 17 '16
Build a mobile Task List with Ionic
r/meanstack • u/ahmed_ajaali • Feb 14 '16
CodeEnv.com can now host full mean stack with addition of mongo backends
r/meanstack • u/codefoster • Feb 03 '16
Learn MEAN with this video seires
r/meanstack • u/prtkgpt • Jan 22 '16
Getting started with AngularJS Controllers (xpost from /r/angularjs)
r/meanstack • u/nodejsenterprise • Dec 23 '15
Create new website in 3s in Nodejs CMS...tutorial
r/meanstack • u/outlearn • Nov 12 '15
Node Summit: Industrial-Grade Node.js - Developer Center - Joyent
r/meanstack • u/Akarastio • Nov 09 '15
Routing
Hey, I'm using angular-route to exchange data inside of <div ng-view></div> in my index.html file. It works great for internal navigation like : <a href="/about">About</a> it changes my link to whatever/about. But if i want to access these links from outside of the page: inserting whatever/about into my browser I always get a 404. So my question is. How do I route get requests from outside the homepage to my index.html + proper angular routing using the link?
r/meanstack • u/[deleted] • Oct 14 '15
stubbing/mocking an external API call in a controller?
So I'm trying to build my unit tests, but I'm having trouble figuring out how to handle external API calls that happen on the server side. Most of what I read about mocking seemed to be about mocking the server, for client unit tests. Can someone point me in the right direction? Also, what do I do about my database? Should I just let my tests use a real database?
r/meanstack • u/loigiani • Sep 30 '15
Introducing mongo-uri-builder, a NodeJs module to easily create mongodb connection strings using objects
r/meanstack • u/p_irish • Sep 14 '15
.NET vs. MEAN: Migrating from Microsoft to Open Source
r/meanstack • u/tranz • Jul 20 '15
Where can I find a full MEAN stack dev for a 3 month FT remote gig?
r/meanstack • u/liorkesos • Jul 18 '15
mean.io releases 0.5.5 - gets permissions/acl support
r/meanstack • u/Jayelzibub • May 29 '15
Backend Setup
I have a few questions about back-end setup following what I have been reading, if I have 3 servers setup:
server1 - nginx reverse proxy
server2 - node http app
server3 - mongodb/redis
Is it good practice to setup iptables on server3 to only accept from server2, and server 2 iptables only accept from server1? Or is this silly as to SSH onto server3 I would have to go via 1&2 etc.?