background preloader

Node.js

Facebook Twitter

NodeSchool. Using Phaser with Visual Studio Code | Damian Connolly. NodeSchool. Maxogden/art-of-node. MongoDB Tutorial.

Advanced tutorials

Hapi. Event Emitters in NodeJs | coligo. In this tutorial we will be exploring the built-in events module in NodeJs and particularly the EventEmitter class through a couple of practical examples. I'll start off by showing you how to create an instance of the EventEmitter and then move on to building our own Node module which inherits from the EventEmitter. So what exactly are event emitters? In NodeJs, any object that emits an event is an instance of the EventEmitter class which exposes 2 important functionalities: The ability to trigger events using eventEmitter.emit(someEvent, optionalData)The ability to assign one or more event handlers to a specific event using eventEmitter.on(someEvent, eventHandler) Let's start off with a simple example to illustrate how an instance of the EventEmitter class can be created and used to listen to and trigger events.

We'll create a function to randomly select a string from an array and trigger an event with this string as the data. Received the string: coligo.io const PubSub = require('.

Koa.js

Top 10 Mistakes Node.js Developers Make. GitHub - auth0-blog/nodejs-jwt-authentication-sample: A NodeJS API that supports username and password authentication with JWTs. An early look at three high-impact ES6 features coming soon to Node.js - RethinkDB. Google is currently developing V8 4.9, which will ship in the upcoming Chrome 49 release. V8 4.9 is a particularly exciting update, because it includes support for 91% of the ECMAScript 2015 (ES6) standard. When Node.js 6 launches with these V8 improvements, powerful new language features like destructuring assignment and proxies will work out of the box–without requiring special measures like command line flags or transpilers.

Although Node 6.0 isn’t scheduled for release until April, you can experience a little bit of the future today by compiling Node’s vee-eight-4.9 branch from source code. The vee-eight branches are where Node’s maintainers do the heavy lifting to make Node compatible with new versions of V8. The code from these branches is understandably not suitable for use in production environments, but it’s a fun a way to get an early look at coming improvements. The example above creates a rank variable that contains the value of the person object’s rank property.

Resources: Maxogden/art-of-node. How do I get started with Node.js. Node.js Tutorials. Node.js Stream Playground. Express - api reference. Hosting Node Apps. This tutorial walks you through setting up a server that can host node.js apps for server-side JavaScript applications. Right now, the node.js hosting options boil down to running node daemon processes that talk to a web server. Most web servers can proxy connections to a different port, so you’ll be able to use Apache or nginx to do this. Step 1: Get a Server or VM I’m using a VMware virtual machine. This is a good way of trying things out before spending money on Amazon or a web host. You could also work locally on a Mac. Let’s get started quickly by downloading a Debian net installer ISO. The standard install options I checked were: DNS server Email server SSH server Standard utilities File sharing (for getting files in/out easily, not needed in production) Step 2: Packages I installed the following packages: apt-get install sudo vim-nox nginx unzip g++ screen git-core monit Step 3: Node You can download Node’s source wherever you want: git clone Then build it: .

Production Practices - Developer Center. How We Built eBay’s First Node.js Application — eBay Tech Blog. For the most part, eBay runs on a Java-based tech stack. Our entire workflow centers around Java and the JVM. Considering the scale of traffic and the stability required by a site like ebay.com, using a proven technology was an obvious choice. But we have always been open to new technologies, and Node.js has been topping the list of candidates for quite some time. This post highlights a few aspects of how we developed eBay's first Node.js application. Scalability It all started when a bunch of eBay engineers (Steven, Venkat, and Senthil) wanted to bring an eBay Hackathon-winning project called "Talk" to production. Mindset Since eBay revolves around Java and since Java is a strongly typed static language, initially it was very difficult to convince folks to use JavaScript on the backend. Within a couple of days, we had an exhaustive list to work on.

Once we had passed the test of our peers' scrutiny, we were all clear to roll. Startup We started from a clean slate. Deployment Monitoring. How To Set Up a Node.js Application for Production on Ubuntu 14.04. Introduction Node.js is an open source Javascript runtime environment for easily building server-side and networking applications. The platform runs on Linux, OS X, FreeBSD, and Windows, and its applications are written in JavaScript. Node.js applications can be run at the command line but we will teach you how to run them as a service, so they will automatically restart on reboot or failure, so you can use them in a production environment. In this tutorial, we will cover setting up a production-ready Node.js environment that is composed of two Ubuntu 14.04 servers; one server will run Node.js applications managed by PM2, while the other will provide users with access to the application through an Nginx reverse proxy to the application server.

The CentOS version of this tutorial can be found here. Prerequisites This guide uses two Ubuntu 14.04 servers with private networking (in the same datacenter). Here is a diagram of what your setup will be after following this tutorial: Install Node.js. Running Node.js apps in production | Frederic Hemberger. Frederic Hemberger @fhemberger Topics I'll talk about today: Deployment Run Node.js (and keep it running) Metrics Deployment Deployment Different popular deployment techniques: Git Hooks GitHub Webhooks Capistrano, Fabric, deploy.sh, et. al. Git Hooks Pushing to Git remote on your server cd /var/www/myapp.com git pull npm install --production service myapp restart ... Done. Git Hooks Pro: Easy for the developer: Just push to production (aka fire and forget) Hosting-Platforms like Heroku use this method as well Con: But what happens on the server?

Solution: Add the deploy script to your repository and symlink to post-receive-hook. GitHub Webhooks When the rest of your development work already resolves around GitHub, it integrates nicely into the workflow Hooks run all independently in parallel: E.g. if the CI hook fails, the webhook for deployment still gets triggered. Capistrano, fabric, deploy.sh, et. al. Additionlly triggers scripts that can: Run Node.js(and keep it running) Start the script as a daemon: NodeJS Cheat Sheet. Advanced nodejs. Node Tuts. Frozen Ridge | 3 Easy Steps to Get The Most from MongoDB and Node.JS.

MongoDB and Node.JS go together like good red wine and steak - that is to say, extremely well. This happy scenario owes to the fact that MongoDB and Node.JS are both built around JavaScript and JSON. MongoDB handles JavaScript natively - there is no impedence mismatch trying to shoe-horn objects into a relational model. Simply persist and query JSON. However, not everything is consistently rosy when using Node.JS and MongoDB together. There are caveats to be aware of. As with any database, your experience using MongoDB is likely only going to be as good as your chosen driver. 1. Based on our experience with customers who have high-volume applications running on MongoDB, we recommend you to use either Mongoose or MongoSkin as your MongoDB driver. Mongoose Mongoose is the heavyweight ORM for Node.js. On the other hand, if you only want to run a few simple queries, or you are allergic to ORMs, Mongoose may be overkill for your needs.

MongoSkin 2. In particular, pay attention to size/growth: 3. Void Canvas. Authentication using Google’s oAuth api with node.js. OAuth authentications are pretty popular now a days and another thing which is popular is JavaScript. This article shows how to plugin google’s oAuth api for authentication in your own node application. The github repo is also available. A background of oAuth OAuth is an authentication technique which provides you a secure and delegate access to some server resources on behalf of the resource owner.

This is a very commonly used technique in third party websites to authenticate a user via his/her facebook, twitter or google account, without disclosing the password and also without taking the headache of storing user credentials in their websites. Get the client-id and client-secret To use oAuth (or any other api) of google you need to create an app in google developers console. Code in node for OAuth I am describing things here with a small node/express application which has few routes and returns normal html with some links. Install express and googleapis modules npm install express-session. Tutorial - Getting Started With Node.js, Express, MongoDB | Christopher Buecheler - Web, Writing, Cocktails and More. Creating a Simple RESTful Web App with Node.js, Express, and MongoDB | Christopher Buecheler - Web, Writing, Cocktails and More.

How To Node - NodeJS. Build a Complete MVC Website With ExpressJS. In this article we'll be building a complete website with a front-facing client side, as well as a control panel for managing the site's content. As you may guess, the final working version of the application contains a lot of different files. I wrote this tutorial step by step, following the development process, but I didn't include every single file, as that would make this a very long and boring read. However, the source code is available on GitHub and I strongly recommend that you take a look.

Express is one of the best frameworks for Node. It has great support and a bunch of helpful features. There are a lot of great articles out there, which cover all of the basics. I assume that you are familiar with Nodejs, have it installed on your system, and that you have probably built some applications with it already. At the heart of Express is Connect. Middleware is basically a function which accepts request and response objects and a next function.

There are two ways to setup Express. Npm. Charts. Write a todo list with Express and MongoDB. A todo list website is a good practice to learn a programing language or a framework. It shows you how to create, read, update and delete records. In this post we are going to use Express as our application framework and MongoDB as our data store. The latest Express 4.x is a little different from 3.x used in the article. I updated the example code on Github. Please take a look and compare. Source On github | Download | Live Demo Functionalities The followings are the functionalities this website should have. Users do not need to login, we use cookie to remeber each user.Users should be able to create, read, update and delete his/her todo list. Installation Development Environment Before we start make sure you have installed node.js, Express and MongoDB. Node.js packages ref : npm basic commands Install Express $ npm install express@3.4.7 -g Also We use Mongoose as our ORM.

Steps Using express command line tool to generate a project bootstrap Add .gitignore file to project root Edit package.json app.js. Front-End Development in Node.js - Raquel Vélez. Turtle Philosophy: Fixing missing VCBuild.exe. From the yeoman generator for angular, when installing socket.io: MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location ofthe component to the system path if it is installed elsewhere. These instructions may be useful when encountering less helpful messages about a missing "VCBuild.exe" file in other programs. You can download the .NET framework v2.0 SDK here. You can download the Visual C++ 2005 ISO from the link in this blog post. Then you can use this utility from Microsoft to mount the iso image and run the installer.

I had problems with permissions with that utility, so I took the easy way out and just burned the Visual Studio ISO to a disk. I received a few errors about compatibility issues when installing for both Visual Studio 2005 and MSSQL Server Express. After those steps, everything worked fine. Node.js - How do Express and hapi compare to each other?

Node.js Frameworks: The 10 Best for Web and Apps Development. Running JavaScript outside the browser turned out to be quite magical for JavaScript lovers and is definitely one of the most welcomed moves in the world of web applications development. Developers all around the globe embraced NodeJS with arms wide open. For those who are new, Node.JS is the JavaScript runtime that allows you to run JavaScript code on the server, outside the browser. It is built on top of Google Chrome’s V8 VM engine that supports JavaScript in the chrome browser. The pace at which NodeJS grew in popularity is due to the fact that it allows you to build large scale, real time and scalable mobile and web applications with JavaScript alone. As the node ecosystem grew, the frameworks also started to surface up to speed up the development workflow.

There are many Node.JS frameworks that allow you to build real time end to end web applications without the need of any other third party web server, app server, tool or technology. 1. . - Use any user authentication scheme. 2. 4. 5. 15 Best Node.js Tools for 2015. Node.js is really getting popular + being used more and more each day and it deserves this attention with the flexibility and performance if offers.

Node.js is a server-side JavaScript environment that uses an asynchronous event-driven model. JavaScript is mostly ran/rendered on the client-side, in the browsers. However, Node.js is a server-side JavaScript interpreter and allows us to handle and make requests via JavaScript. In this article we have compiled a list of some Best Node.js Tools for Developers in 2015. 1. JavaScript I/O is an npm compatible platform that was originally based on Node.js and built on Chrome’s V8 Runtime. 2. Math.js is an extensive math library for JavaScript and Node.js. 3.

Cylon.js is a JavaScript framework for robotics and physical computing built on top of Node.js. 4. Migrat is a pluggable Node.js migration tool that is not tied any particular database engine and supports multi-node environments. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. . — Gavin. GitHub - kin9puppy/vcbuildFixForNode: fix for vcbuild.exe error on node.

Jade - Template Engine. How to install Node.js on managed hosting accounts | A2 Hosting. This article describes how to install the Node.js platform on managed hosting accounts (please see the Article Details sidebar to the right for a complete list of supported products). You can use Node.js to host third-party applications or you can run your own applications. Installation prerequisites There are two prerequisites for running Node.js on a managed hosting account: Your account must have the normal shell (not jailshell) enabled. To determine which shell your account is using, log in using SSH, and then type the following command: echo $SHELL If your account is using jailshell, please open a support ticket on the Customer Portal at and request normal shell access for your account.Node.js currently only works on servers running CentOS 6. Installing Node.js and npm After you determine that your account meets the installation prerequisites, you can download and install Node.js and npm (the Node.js package manager).

Starting a Node.js application pkill node. Npm. The Node Beginner Book » A comprehensive Node.js tutorial. Felix's Node.js Beginners Guide. « Home / All Guides There is lots of information about node.js, but given the rapid pace at which it is developing, it can be difficult for beginners to find good, current information on how to get started. This guide aims to provide exactly that, whilst staying updated with the latest stable version of node.js.

This guide has been updated to reflect the latest changes in node 0.4.x, the currently stable branch of node.js. Learning JavaScript This guide assumes that you are already familar with JavaScript. Hello World Tutorial This tutorial guides you through installing node.js, including the creation of a simple hello world http server. Installation First of all: You should run a *nix operating system in order to use node.js at this point. The most common way to install node.js is to directly compile it from the downloaded source code. You can get the latest source code from nodejs.org. . $ wget $ tar -xzf node-v0.4.4.tar.gz $ cd node-v0.4.4 $ . Express. How to run Hello World - Nodejs. Plans and Pricing - OpenShift Online. What is Node.js Exactly? - a beginners introduction to Nodejs. Develop desktop app using Node-webkit. Express. Tutorial - Getting Started With Node.js, Express, MongoDB | Christopher Buecheler - Web, Writing, Cocktails and More.

Express - Node.js web application framework. Simple CRUD Node.js & MySQL. Don't forget to read this Post...