Questions tagged [serverside-javascript]

Server-side JavaScript is a set of techniques allowing to build JavaScript applications directly on the server.

Server-side JavaScript is a set of techniques allowing to build JavaScript applications directly on the server.

The most popular server-side JavaScript project is node.js, built on Chrome's JavaScript runtime, V8.

Other server-side JavaScript environments include Jaxer and Narwhal.

CommonJS project also provides a set of APIs which can be used outside the browser.

412 questions
826
votes
11 answers

Node.js Best Practice Exception Handling

I just started trying out node.js a few days ago. I've realized that the Node is terminated whenever I have an unhandled exception in my program. This is different than the normal server container that I have been exposed to where only the Worker…
momo
  • 21,233
  • 8
  • 39
  • 38
390
votes
22 answers

nodejs vs node on ubuntu 12.04

I installed nodejs on ubuntu from instructions given here When I write node --version in the terminal I see this : -bash: /usr/sbin/node: No such file or directory I can see node in the /usr/sbin/ directory, though. Writing npm --version shows…
Jatin
  • 14,112
  • 16
  • 49
  • 78
285
votes
15 answers

user authentication libraries for node.js?

Are there any existing user authentication libraries for node.js? In particular I'm looking for something that can do password authentication for a user (using a custom backend auth DB), and associate that user with a session. Before I wrote an auth…
shreddd
  • 10,975
  • 9
  • 33
  • 34
236
votes
5 answers

Node.js and CPU intensive requests

I've started tinkering with Node.js HTTP server and really like to write server side Javascript but something is keeping me from starting to use Node.js for my web application. I understand the whole async I/O concept but I'm somewhat concerned…
Olivier Lalonde
  • 19,423
  • 28
  • 76
  • 91
218
votes
3 answers

Why does the JavaScript need to start with ";"?

I have recently noticed that a lot of JavaScript files on the Web start with a ; immediately following the comment section. For example, this jQuery plugin's code starts with: /** * jQuery.ScrollTo * Copyright (c) 2007-2008 Ariel Flesler -…
TK.
  • 27,073
  • 20
  • 64
  • 72
154
votes
2 answers

What is non-blocking or asynchronous I/O in Node.js?

In the context of Server Side Javascript engines, what is non-blocking I/O or asynchronous I/O? I see this being mentioned as an advantage over Java server side implementations.
Anand
  • 2,329
  • 4
  • 19
  • 25
146
votes
4 answers

Why and when to use Node.js?

Possible Duplicate: How to decide when to use Node.js? Sorry if I'm a bit ambiguous, but I'm trying to understand the real advantages of using Node.js instead of other server-side language. I'm a JavaScript enthusiast, so I'm probably going to…
gion_13
  • 41,171
  • 10
  • 96
  • 108
130
votes
5 answers

How does setTimeout work in Node.JS?

I guess that once it's executed it's on the queue, but in the queue is there any assurance it will invoke exactly after X milliseconds? Or will other heavy tasks higher on the queue delay it?
MyCodeGone
  • 1,309
  • 2
  • 9
  • 4
73
votes
10 answers

Preventing XSS in Node.js / server side javascript

Any idea how one would go about preventing XSS attacks on a node.js app? Any libs out there that handle removing javascript in hrefs, onclick attributes,etc. from POSTed data? I don't want to have to write a regex for all that :) Any suggestions?
Techwraith
  • 1,298
  • 1
  • 10
  • 12
61
votes
8 answers

Using a .NET DLL in Node.js / serverside javascript

I have a pet project that is an online game, the entire game engine is written in C# and I would like to know if there is anyway I can call the functions of this existing assembly (.dll) from a solution built using Node.JS, Socket.IO, Express…
David
  • 8,340
  • 7
  • 49
  • 71
38
votes
11 answers

JavaScript pass scope to another function

Is it possible to somehow pass the scope of a function to another? For example, function a(){ var x = 5; var obj = {..}; b(); } function b(){ //access x or obj.... } I would rather access the variables directly, i.e., not…
ciochPep
  • 2,472
  • 4
  • 26
  • 30
35
votes
9 answers

Referencing Google's V8 engine from a .NET app

I'm building a .NET 3.5 application and have the need to evaluate JS code on the server - basically a user provided rule set that can work within a browser or on the server. Managed JS is not an option, because the JS code would be provided at…
NathanD
  • 8,061
  • 7
  • 30
  • 26
31
votes
9 answers

Next.js return the 404 error page in getInitialProps

Currently I am following this example on how to redirect users in getInitialProps https://github.com/zeit/next.js/wiki/Redirecting-in-%60getInitialProps%60 The problem is, if I want to return 404 like this, it will return a blank page instead of the…
Thomas Charlesworth
  • 1,789
  • 5
  • 28
  • 53
31
votes
5 answers

node.js running alongside Apache PHP?

I am trying to get my head round node.js... I am very happy with my LAMP set up as it currently fulfils my requirements. Although I want to add some real-time features into my PHP app. Such as showing all users currently logged into my site and…
wilsonpage
  • 17,341
  • 23
  • 103
  • 147
31
votes
4 answers

How is a functional programming-based JavaScript app laid out?

I've been working with node.js for a while on a chat app (I know, very original, but I figured it'd be a good learning project). Underscore.js provides a lot of functional programming concepts which look interesting, so I'd like to understand how a…
1
2 3
27 28