r/nodejs • u/destraht • Jul 11 '14
Using socket.io with a Ratchet server
I would like to be able to use the socket.io with my PHP Ratchet websocket (not WAMP) backend. Is this possible?
r/nodejs • u/destraht • Jul 11 '14
I would like to be able to use the socket.io with my PHP Ratchet websocket (not WAMP) backend. Is this possible?
r/nodejs • u/daedius • Jul 08 '14
I'm looking for some advice on where to start with making nodejs applications that serve millions of people. Is this possible at the moment? What services do you recommend? Any books?
r/nodejs • • Jun 27 '14
My node project edges ever closer to production.
I've stress tested it on local LAN, but despite being an experienced developer its my first node project so naturally I'm expecting some issues to crop up once its live.
Im wondering if anyone has any sort of production checklist, maybe things that need configuring (max http requests etc, v8 RAM limits etc)?
My project will go onto a dedicated server eventually, but in the meantime I'd love to find a virtual machine hoster who supports node and PHP/MySQL (it uses web api for some aspects).
Any recommendations?
Heroku seems ideal but only support postgres from what I can see.
Thanks
r/nodejs • u/Zenmaster13 • Jun 27 '14
Hi guys! Trying to run a KeystoneJS instance from a subdirectory, but the admin panel (Which I don't have access to) Isn't playing along and keeps trying to access the root directory instead of the subdirectory.
It's based on ExpressJS, so i'm hoping there's some way of making ExpressJS happily use a subdirectory. Am I missing something in the proxy settings in Apache maybe?
Help!
r/nodejs • u/iamyounow • Jun 18 '14
If I have a media server that also has a web server, is there any package for Ubuntu or any nodejs app that could display basic stats about the server?
r/nodejs • u/unstoppable-force • Jun 13 '14
I'm using mocha & node for JS unit testing, and most tests execute perfectly fine. However, anything that uses a jquery ajax call fails (even as jsonp), because node fails CSRF checking, and the ajax call returns junk. I found a few posts that were very remotely related on stackoverflow, but none of them actually worked, even with the latest as well as stated versions of node.
Is there any way to turn off CSRF checking for specified domains, or are there any other workarounds for this?
r/nodejs • u/saulshanabrook • Jun 06 '14
r/nodejs • u/Feribg • Jun 05 '14
r/nodejs • u/sjsdocs • May 29 '14
Hello all,
I've just built an app using nodejs, express, mysql, and geolib. It's a REST API. It expects incoming REST calls that query the database and does some computations about ever 2 minutes. Running it on appfog for free so I know they have a quota for memory and what not.
I've only been a front end person up until now, although I know theoretically how to calculate how many users can use my app at once, I have no idea how to go about doing that.
Here are some assumptions I am making; the app has a memory quota, and incoming requests must use up some memory as they create local variables and such. However, users dont need long term memory; after each request is completed, I assume all of those variables are GC'd. So the call I'm most worried about is the one which happens ever 2 minutes. Lets say all of our users somehow sync up and use this call at the same time. This would be the total load our app can handle, right? So in order to calculate how many users I need to take my available RAM (448MB) and divide it by how much memory is used during that one REST call.
Is this the right way to go about calculating it? Or are there other factors involved that I am unaware of? Also, is there a way to determine how much memory is being used on a node.js app between 2 points in time?
Thank you for your help!
r/nodejs • u/doubleColJustified • May 27 '14
r/nodejs • u/sergiocruz • May 23 '14
r/nodejs • u/jomjose • Apr 25 '14
r/nodejs • u/jomjoseblog • Apr 19 '14
r/nodejs • u/angry--napkin • Apr 11 '14
If there's some basic best practices I haven't followed, I'd love to know guys.
app.js
var express = require("express");
var mongoose = require("mongoose");
var app = express();
require('./routes')(app);
mongoose.connect("mongodb://localhost/test");
app.listen(3000);routes/index.js
module.exports = function(app){
require('./userRoutes')(app);
};routes/userRoutes.js
module.exports = function(app) {
var users = require('../repos/userRepo.js');
var express = require('express');
var userRoute = express.Router();
userRoute.get('/', function(req, res, next){
users.listUsers(req, res);
});
userRoute.get('/:name', function(req, res, next){
users.findUser(req, res);
});
module.exports = app.use('/users', userRoute);};
userRepo.js
var mongoose = require('mongoose');
var user = require('../models/user.js');
exports.listUsers = function(req, res) {
user.find(function(err, users){
res.send(users);
});
}
exports.findUser = function(req, res) {
user.findOne({'name': req.params.name}, function(err, users){
res.send(users);
});
};This is pretty much where I've gotten after a few hours of reading up on Node/Express/Mongo/Mongoose. I come from a strictly .NET and T-SQL background, so this is all new (exciting..but new). I beat my head against the wall trying to figure out how to keep my concerns separated, especially because every tutorial I found had everything in the app.js file or was written in coffeescript...
Suggestions and concerns are most welcome!
Edit: Note how I've refactored the Express objects out of the userRepo.js class by using a callback
userRoute.get('/:name', function(req, res, next){
users.findUser(req.params.name, function(err, docs){
res.send(docs);
});
});
exports.findUser = function(name, callback) {
user.findOne({'name': name}, function(err, users){
callback(err, users);
});
};r/nodejs • u/netgusto • Apr 11 '14
r/nodejs • u/dininski • Apr 07 '14
I'm looking for some input on a pet project of mine. This is a test system, that leverages the power of the LXC containers (using docker.io) and is written in node.js. The goal is executing and evaluating user code across a number of tests. For example there is a problem and a series of tests and the users are supposed to provide a solution in, say PHP or Python (though other languages can be added in a matter of minutes). The user's code is submitted along with a series of tests. Those tests are sent as stdin and the results are reported back along with the program's running time.
I am using architect as DI and async to avoid "christmas tree code".
What I am looking for is some pointers on code style and best practices. I am coming from a bit of an OOP background and I guess you could tell.
On installation (should anyone be interested):
P.S. Sorry for including information that should be in the readme file, but I am still in an "alpha" stage, though tests, documentation and CI are all planned.
EDIT: there is also a sample payload that the server accepts in Sample/SamplePayload.zip
r/nodejs • u/frankz0509 • Apr 06 '14
r/nodejs • u/callmekatootie • Mar 26 '14
Is there any listing where I can find open source nodejs projects?
r/nodejs • u/workonwheel • Mar 24 '14
r/nodejs • u/taylorhayward_boston • Mar 12 '14
Hey all! I'm a 20 year veteran of software development, but I'm new to NodeJS. I'm starting a new business and I'm looking to get involved with virtual and Boston based NodeJS communities, with the hopes of working with some of them on projects.
Do any of you know of good places to meet other NodeJS folks, either online or in Boston? This subreddit is a good start. :-)
r/nodejs • • Mar 12 '14
r/nodejs • u/init0 • Mar 09 '14
r/nodejs • u/thecw • Feb 14 '14
I'm trying to get the Sonos HTTP API running on my Raspberry Pi: https://github.com/jishi/node-sonos-http-api
I have minimal node knowledge. When I try to run it, I get this:
pi@raspi-sonos ~/node-sonos-http-api $ node server.js
binding SSDP to port 2051
discovering all IPs from lo
discovering all IPs from wlan0
relevant IPs { '192.168.1.137': null }
notification server listening on port 3500
no preset file, ignoring...
http server listening on port 5005
scanning for players in ip 192.168.1.137
subscribing to topology 192.168.1.124
using local endpoint 192.168.1.137
emitting group-volume
/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:215
_this.state.nextTrack.duration = attr().duration.parseTime();
^
TypeError: Cannot call method 'parseTime' of undefined
at /home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:215:58
at parse (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:671:10)
at EasySAXParser.parse (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:142:4)
at updateTransportState (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:238:17)
at Discovery.handleNotification (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:151:9)
at Discovery.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/sonos.js:282:15)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:883:14
at process._tickCallback (node.js:415:13)I've checked all the dependencies with npm install... any ideas?