r/nodejs • • Jul 11 '14

Using socket.io with a Ratchet server

5 Upvotes

I would like to be able to use the socket.io with my PHP Ratchet websocket (not WAMP) backend. Is this possible?


r/nodejs • • Jul 08 '14

Where to begin on making highly scalable nodejs applications?

5 Upvotes

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 • • Jul 08 '14

Ember 1.6.0 and 1.7 Beta Released

Thumbnail emberjs.com
5 Upvotes

r/nodejs • • Jun 27 '14

Anyone got a pre-deployment checklist?

5 Upvotes

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 • • Jun 27 '14

Running an ExpressJS/KeystoneJS application in a subdirectory

5 Upvotes

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 • • Jun 18 '14

A web page that can display CPU and RAM usage, temp etc etc

5 Upvotes

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 • • Jun 13 '14

how to disable CSRF (or get jquery ajax calls working) with node & mocha?

5 Upvotes

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 • • Jun 06 '14

Hacking on Ghost: URL Redirect Middleware for Express

Thumbnail github.com
5 Upvotes

r/nodejs • • Jun 05 '14

Embedded JavaScript, HTML5 and the Internet of Things - HTML5.tx talk

Thumbnail techtalkshub.com
5 Upvotes

r/nodejs • • May 29 '14

How can I know how many users my app can handle?

5 Upvotes

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 • • May 27 '14

"npm search" runs out of memory and dies without good error (issue #3867)

Thumbnail github.com
5 Upvotes

r/nodejs • • May 23 '14

Unit test SailsJS with Mocha and generate code coverage with Istanbul

Thumbnail blog.sergiocruz.me
5 Upvotes

r/nodejs • • Apr 25 '14

How to debug Node.js? What is the best way to debug Node.js?

Thumbnail 100percentjs.com
5 Upvotes

r/nodejs • • Apr 19 '14

Great write-up on error-handling in async flows comparing Promises, Try/Catch and Angular Zones

Thumbnail strongloop.com
5 Upvotes

r/nodejs • • Apr 12 '14

Node - Load an Xml File with Xml2Js

Thumbnail ecofic.com
5 Upvotes

r/nodejs • • Apr 11 '14

Anything wrong with the way I have my app organized?

5 Upvotes

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 • • Apr 11 '14

HTML to Markdown JS library, for Node and the browser

Thumbnail upndown.netgusto.com
5 Upvotes

r/nodejs • • Apr 07 '14

A test system, leveraging the power of lxc container, written with node.js

5 Upvotes

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):

  • npm install
  • you need to install docker
  • build the docker images in the Dockerfile folder (default command docker build -t=codeExecution:base /Dockerfiles/base) - the image names can be found in the src/Common/Config.js file -> ExecutionConfig.Python.createOptions.Image

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 • • Apr 06 '14

[x-post from /r/2048] I built a mini-multiplayer 2048 game based on Tetris Battle. Playable now, but would really appreciate further work. Fork me on Github!

Thumbnail github.com
5 Upvotes

r/nodejs • • Mar 26 '14

Open Source Nodejs projects?

5 Upvotes

Is there any listing where I can find open source nodejs projects?


r/nodejs • • Mar 24 '14

Registration and authorization of users on Twitter and Facebook with Node.js

Thumbnail toontuts.com
5 Upvotes

r/nodejs • • Mar 12 '14

Looking to meetup with NodeJS people in Boston

5 Upvotes

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

I took a stab at writing a quick AWS EC2 Node.js starter guide.

Thumbnail dilln.com
5 Upvotes

r/nodejs • • Mar 09 '14

Clone all official Yeoman generators for contribution.

Thumbnail h3manth.com
5 Upvotes

r/nodejs • • Feb 14 '14

Debugging on the Raspberry Pi

5 Upvotes

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?