Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js Examples [closed]

Are there any useful examples of node.js (such as a guestbook or chat room)?

like image 430
Mirgorod Avatar asked Mar 08 '11 18:03

Mirgorod


People also ask

What is closure in JS with example?

A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function's scope from an inner function.

How do I close a NodeJS connection?

end() before the callback is triggered, because Closing the connection is done using end() which makes sure all remaining queries are executed before sending a quit packet to the mysql server.

How do I stop NodeJS from listening?

server. close() prevents new connections and waits until all the clients are closed. To forcibly kill a node server you need to call server. close() and then close all the open connections from the server end.

Why are closures useful?

Closures are important because they control what is and isn't in scope in a particular function, along with which variables are shared between sibling functions in the same containing scope.


1 Answers

Read about what I did to make it here: http://www.travisglines.com/web-coding/lets-make-a-twitter-clone-in-node-js

Check out the source code here: https://github.com/tglines/nodrr

like image 66
Travis Avatar answered Sep 21 '22 03:09

Travis