node.js

Implementing Facebook Authentication With Node.js

Submitted by admin on
In this small project we'll see how to implement Facebook authentication for your Node app with a help of Passport.js. Facebook authentication might sound like a lot of work but with the help of Passport, it is a surprisingly easy task. To give you a good feeling about the volume of code that you're about to write: It is about 80 lines of JavaScript and couple more lines of HTML. Before we start let's see how our application will look like. This is a truely minimalistic app with two pages: a login page and a "secret" page that only authenticated users are allowed to see.

Logging in Node.js

Submitted by admin on
Logging is one of the most undervalued and most important features of an enterprise application. Logs is what makes a difference between spending sleepless nights catching a mysterious bug or reading a clear message about what exactly caused an application to crash. It is not just important to write logs. It is important to write logs in a right way. In this article we'll look at most popular Node.js logging solutions and how to use them in your application. console.log ----------------- Option #1 - console.log().

Deploying Node.js production. Part 1: Using pm2.

Submitted by admin on
Once the development is complete - you are ready to share your application or with the world. Here comes the question: how exactly do you deploy it? Obviously, you can't just run "node main.js" and leave it like that. If the application crashes due to untested error or out of memory, you don't want your service to be interrupted. Instead the applicatoin should be automatically restarted, giving you some extra time to investigate the issues. NOTE: have you completed my other tutorials about building Node.js web chat and web game?

Building HTML5 Multiplayer Game with Node.js

Submitted by admin on
In a previous tutorial, I showed how to build a Socket.IO chat and connect few people around the globe with the magic of WebSockets. In this article I want to make this project a little bit more fun and turn it into a multiplayer game: "rock, paper, scissors". So let's grab the previous code and introduce few modifications.

Creating Real-Time Chat with Node.js and Socket.IO

Submitted by admin on
The way that people use internet evolved from static pages to Ajax and now to realtime web supported by standards like WebSockets and WebRTC. Making a real-time application, like chat, became increadibly easy with the help of platforms like Node.js and libraries like Socket.io. In this post we'll see how to create a minimalistic chat application form the scratch. Create a separate folder for your new project and type `npm init` in it. Then, install the required dependencies.

Handling File Uploads with Node.js and Express.js

Submitted by admin on
Whether you are building social platform or a simple website, sometimes you need to let users upload their own files. The typical scenario might be: uploading the user's photo for a profile page. With Node.js and express it is quite easy to create your own file upload service. In this post I will show you how. In the new folder run `npm init`, and create `package.json` as you usually do for every fresh Node project.

Building REST service with Express.js

Submitted by admin on
REST services became a de-facto standard of data exchange for public APIs. Twitter, GitHub, Parse are just few examples that rely on REST to exchange data with the clients. Before we start to write our first REST service with Node, let's see what exactly is REST and how it works. REST stands for 'REpresentational State Transfer'. It leverages the semantics of HTTP protocol to express operations over a some collection of items (data). REST typically uses JSON to send and receive data. NOTE: This is a common misconception to call every HTTP-based JSON service REST.