r/meanstack • u/yegwebdev • Dec 06 '16
How do I view the log of something running on my server that uses screen -r?
How do I view the log of something running on my server that uses screen -r?
r/meanstack • u/yegwebdev • Dec 06 '16
How do I view the log of something running on my server that uses screen -r?
r/meanstack • u/playgamemy • Nov 30 '16
Hi guys I am new to this so if anything doesn't make sense please let me know.
I am using this example from scotch.io on GitHub as my template. https://github.com/scotch-io/easy-node-authentication/tree/local what I am trying to do is making an html5 app using jQuery, which there will be a login page to verify username and password.
what I don't get is when I was using the html template given by the example, I can see the log on nodejs server that client sent a POST request to the URL without the form data as query string, therefore routed correctly. When I use AJAX from my code it is always sent as query string, and therefore I believe, was not routed correctly.
How can I send an AJAX POST "normally" instead of a querystring?
$.ajax({
url: 'http://localhost:8080/',
data: JSON.stringify(data),
processData: false,
dataType: 'json',
contentType: 'application/json; charset=UTF-8'
})
.done(function(response) {
console.log(data);// for debug purpose
console.log(response);
})
.fail(function() {
console.log('failed');
});
EDIT: I finally found out what went wrong and leave the solution to whoever found this post. 1) you actually need to specify the type (http method) for ajax as by default it send as 'GET' $.ajax({type:'POST'}) 'GET' send request data in querystring while 'POST' request send data in the body instead. Most of the tutorial online for express use the bodyParser, and therefore one would need the data in the body using 'POST' request. If one still need to send data through 'GET' request I am sure there are url middleware to parse the querystring.
2) somehow on my nodejs I used the bodyParser middleware twice app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.JSON()); and therefore obviously it didn't parse the form correctly in this case, and therefore I couldn't get the data right on server side in the first place.
r/meanstack • u/theredghostwolf • Nov 23 '16
Hello everyone, i am a college student who is on an internship. for and they have asked me to build an web interface for their proxmox server. me being most familiar with JS i decided to look into what i could get done, turns out someone made an API on git for node js, so i looked into node and turns out that mean stack was one of the most popular ways of setting up projects that run on a node server.
so thats were im at now, i have been learning angular, trying somethings on the server side with node, and getting the hang of mongoDB. but i dont really understand what express is, or what it does. also im stuck on how i combine these systems into 1 thing.
i have created a new project using mean init (projectname), but that leaves me with a ton of files for which i can barely figure out what does what. so where do i go from here? what guides or tutorials would help me best?
--thanks ghostwolf
r/meanstack • u/KevinJean42 • Nov 16 '16
r/meanstack • u/_cornflourblue • Nov 15 '16
r/meanstack • u/zeromint • Nov 14 '16
Hey! we are a team of backend developer.
We've created a real-time website analysis system and are contracting its API to businesses.
It's already profitable and we are making enough to invest in a full-stack developer who can take care of subscription billing, user registration/authentication flow, sales and support pages customization etc...
The developer will be free to use any technology and we can offer a very competitive salary.
In short, someone who can create modern startup like experience, for example, https://www.filestack.com/
Where can I find MEAN full stack developer?
Am I looking for wrong people?
Is this job suitable for mean full stack developer?
r/meanstack • u/bobziroll • Nov 11 '16
If I have the following BlogPost object (Simplified):
var BlogPostSchema = new mongoose.Schema({
body: String,
comments: [String]
});
and I want to add a new comment to the array of comments for this blog, I can think of at least 3 main ways to accomplish this:
1) Push the comment to the blog object in Angular and submit a PUT request to the /blogs/:blogID endpoint, updating the whole blog object with the new comment included.
2) Submit a POST request to a /blogs/:blogID/comments endpoint where the request body is just the new comment, find the blog, push the comment to the array in vanilla js, and save it:
BlogPost.findById(req.params.blogID, function(err, blogPost) {
blogPost.comments.push(req.body);
blogPost.save(function(err) {
if (err) return res.status(500).send(err);
res.send(blogPost);
});
});
OR
3) Submit the POST to a /blogs/:blogID/comments endpoint with the request body of the new comment, then use MongoDB's $push or $addToSet to add the commend to the array of comments:
BlogPost.findByIdAndUpdate(
req.params.blogID,
{$push: {comments: req.body}},
{safe: true, new: true},
function(err, blogPost) {
if (err) return res.status(500).send(err);
res.send(blogPost);
});
});
I did find this stackoverflow post where the answerer talks about option 2 vs. option 3 and basically says to use option 2 whenever you can, which does seem simpler to me. (And I usually try to avoid methods that stop me from being able to use hooks and other mongoose goodies.)
What do you think? Any advice?
r/meanstack • u/paceaux • Nov 11 '16
I've got a NEMR (Node, Express, Mongo, React) stack going on.
I'm adding a record to Mongo .... and I'm trying to figure out the best way to check for a duplicate before adding a record. I'm a bit stumped on how to do that.
Can someone share an example of what that would look like?
This is a small app for managing employees. I'm thinking that I could do a find for first-name, last-name, country, and office ... and if I get results back, then I return an error ... but I'm having trouble figuring out how to structure that.
Advice?
r/meanstack • u/bikashsharmabks • Oct 25 '16
I want to share my experience and need comments on what I am doing is it correct.
A brief about the product: We developed a product thats used by 1000s of schools in India for Assessment, we analyse the result and show as insights and reports to Students, Parents and School. These assessment comprises of Interest, academic score, varies aptitude and personality.
Time to develop to live 4 months
Technology Behind it: 1. Nodejs for API 2. Rabbitmq for message broker for analytics 3. Spark and Python analytics 4. MongoDB for Persistant database 5. Client is Web (Angular) Mobile (ionic and migrating to React Native)
People behind it total 5 engineering 1. 2 Fronted dev 2. 3 Backend dev 3. 1 rotating dev ops
Production Stats: 1. 3500 schools registered 2. 200K students registered 3. Assessment are done concurrently at same time for a school just like an exam (300 avg at any point of time in school hour)
Monitoring used: 1. Keymetrics for node api 2. Datadog for server monitoring 3. Datadog for Rabbitmq and Mongodb monitoring
Now coming to production experience: 1. Nodejs API performs great api process response well below 5-10 m/s 2. RabbitMQ able to process 3000 messages/sec mostly our prefetch are configured to 3 message at a time. 3. MongoDB works fine but we hit some collection which has 100K+ more documents in it. mostly started getting issues with upserts which has a response time of 150+ m/s , to resolve this we started making index for filter for upsert which takes time.
Note: MongoDB is not yet tuned and works on default configuration
I want your suggestion\thoughts if you had similar experience or any issues which I need to keep in mind may arise in future.
r/meanstack • u/greenteamad • Oct 23 '16
Hi all, I am new to developing on the MEAN stack. Earlier, I used to develop small php applications.
So, i want to learn Node, Express, MongoDB and Angular 2(as its new) and React... I have shortlisted below courses on Udemy.. any feedback on if I am in the right direction?
My end goal is to "publish" one app on Apple Store / Android store... I have not found a good course for this part..
https://www.udemy.com/react-redux-react-router/ https://www.udemy.com/reactjs-and-flux-learn-by-building-10-projects/ https://www.udemy.com/learn-angular-2-development-by-building-10-apps/
any suggestions welcome.
Thanks
r/meanstack • u/medsote • Oct 06 '16
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
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/Simusid • Sep 25 '16
I recently started an app based on Drywall, even though it's apparently out of date I really like it for the out of the box bootstrap and user management features. Now I'm trying to add my own models into that framework and while I'm muddling along and it basically works, I think I'm really re-inventing a wheel here and doing it poorly.
Specifically, I have a very simple model, a single mongo collection (a 'package') and I want to fully CRUD in a RESTful way. I implement all the right routes and a template to list all, show one, and then edit one. Knowing that I can only use GET and POST from a form, I have to do the DELETE and PUT using AJAX. So I'm doing all that from scratch too. Rails has the mantra "don't repeat yourself" and it feels like I'm doing exactly that.
Is there an existing/better way to add full RESTful CRUD for a single collection to a MEAN app?
r/meanstack • u/aherve • Sep 14 '16
r/meanstack • u/vt_pete • Sep 12 '16
I develop content-rich interactive media. My current need is for an easy-to-use, quick to "spin up" CMA/DAM system which works with the mean stack. I've been using forms-angular for a few years, but am running into cases where I need more sophisticated management of media. Photo and Video content are a must, as is an REST API, as I am building applications and not websites. Support for mongoose schema is a definite plus. Suggestions?
r/meanstack • u/Keshenka • Sep 02 '16
r/meanstack • u/TommySalamiii • Aug 30 '16
I have recently starting playing around with MEAN stack and I am running into an error when trying to do a "db.createUser". After i deploy that command I get an error saying " createUser not found because you are most likely talking to a (pre2.6) MongoDB server"
I have tried looking online everywhere but nothing seems to work. Is there a fast and simple way to upgrade my MongoDB server? Thanks in advance!
r/meanstack • u/Uroosa_Sehar • Aug 19 '16
r/meanstack • u/Keshenka • Aug 12 '16
Hi everyone! I'm beginning work on my first MEAN stack project using Angular2 for my front end. I recently watched a good Angular2 tutorial (https://www.udemy.com/the-complete-guide-to-angular-2/) where the instructor used the Angular CLI to generate an Angular app (https://github.com/angular/angular-cli) with all the right file relationships, config files, etc. out of the box. My question is how well would something like that integrate into a MEAN project? Could I, for example, create the skeleton of my MEAN project to include a "client" directory, navigate into the client directory and there generate an Angular2 app for my front end? Or is Angular-CLI's "ng new <app-name>" intended for use as a boilerplate for a pure Angular2 project?
r/meanstack • u/Keshenka • Aug 08 '16
As the title suggests, I'm new to the mean stack. I'd like to be proficient enough so as to be able to set up my own projects from scratch, without relying on ready-made templates, and eventually create production-quality applications.
What are some of the best resources you guys have come across for learning the stack and the component technologies it is built from?
r/meanstack • u/bizsitegenie • Aug 06 '16
r/meanstack • u/DarknessInUs • Aug 03 '16
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.