background preloader

Node JS

Facebook Twitter

Handling AJAX calls with Node.js and Express (scraping Craigslist) - Michael Herman. This tutorial is meant for someone who’s finished a basic Hello World project with Node and Express and ready to take another step.

Handling AJAX calls with Node.js and Express (scraping Craigslist) - Michael Herman

In short, I’ll show you how to search/scrape/crawl Craigslist using AJAX along with Node and Express. I assume you’re working from a Unix-based environment, already have Node and Express installed, and understand how to navigate the terminal. You can find the finished code on this repo if wish to bypass the tutorial altogether. Let’s get right to it. Here is an index of all the articles in the series that have been published to date: Project Setup Navigate to where you’d like your project to reside, then run the following command: CD into the newly created directory and install the node modules: Aside for the installed node modules/dependencies, your project structure should look like this: In short, your server-side Javascript is held in the app.js file, while the client-side file(s) will be placed in the “javascripts” directory.

Still with me? Workflow Ready? Form Validation With ExpressJS. Simple Node.js Express MVR Template. In this post we’ll walk through how to setup a simple MVR Node.js project using Express, Mongoose (MongoDB), Jade (templating) and everyauth (authentication).

Simple Node.js Express MVR Template

First off, what the fuck is MVR, think MVC but with routes instead controllers. What we’re going to be using Express for our framework Mongoose for MongoDB Jade for templating everyauth for authentication Twitter Bootstrap for styling. NodeJS : moduler son code. Node.js, Require and Exports. Back when I first started playing with node.js, there was one thing that always made me uncomfortable.

Node.js, Require and Exports

Embarrassingly, I'm talking about module.exports. I say embarrassingly because it's such a fundamental part of node.js and it's quite simple. In fact, looking back, I have no idea what my hang up was...I just remember being fuzzy on it. Assuming I'm not the only one who's had to take a second, and third, look at it before it finally started sinking in, I thought I could do a little write up. In Node, things are only visible to other things in the same file. Var x = 5; var addX = function(value) { return value + x; }; Another file cannot access the x variable or addX function.

Now, before we look at how to expose things out of a module, let's look at loading a module. Var misc = require('. Of course, as long as our module doesn't expose anything, the above isn't very useful. Node.js, Module.Exports and Organizing Express.js Routes. A while ago I wrote a post explaining how require and module.exports work.

Node.js, Module.Exports and Organizing Express.js Routes

Today I wanted to show a practical example of how we can use that knowledge to organize routes in an express.js project. To recap the original post, module.exports is how we make something within our file publicly accessible to anything outside our file. An Absolute Beginner's Guide to Node.js. There's no shortage of Node.js tutorials out there, but most of them cover specific use cases or topics that only apply when you've already got Node up and running.

An Absolute Beginner's Guide to Node.js

I see comments every once and awhile that sound something like, "I've downloaded Node, now what? " This tutorial answers that question and explains how to get started from the very beginning. Karlbright/The-Node-Beginner-Book. Drywall - A website and user system for Node.js. The Front-End Pages Home, about, sign-up and contact us.

Drywall - A website and user system for Node.js

Authentication Screens Login, forgot password and reset password. The Administration Area Manage users, accounts, admins, admin groups, statuses, categories and search. The Account Area. Justin-john/node-user-management. Express/examples at master · visionmedia/express. Node-user-management/docs/index.md at master · justin-john/node-user-management. Express/examples/static-files/index.js at 2c174d6b3bd4cb56184bddeae15d714bb8e09c9e · visionmedia/express. Building a Login System in Node.js and MongoDB. This past week I finally got around to playing with Node.js and am really impressed with how simple it was to get a server and database up and running in literally minutes.

Building a Login System in Node.js and MongoDB

Once there, I thought a good first project to explore the platform would be to try building a simple login system analogous to what I feel like I’ve built a million times in mysql & php. So after thinking about it a bit, I knew these were the basic features I wanted to implement : Login Panel Just a simple login panel with the ability to reset a lost password and of course the ability to create an account for first time users.An option to “remember me” that saves the user’s data in a local cookie allowing them to bypass the login screen whenever they revisit the site. New Account Screen A simple form that allows a new user to set their username & password,as well as some personal data such as their real name, email and location. Account Update Screen Password Retrieval If you’d like to jump ahead : Application Structure. Building a Login System in Node.js and MongoDB. An example NodeJS / Mongoose / Express application based on their respective tutorials.

SOAP vs. REST : choisir la bonne architecture web services. De plus en plus d’entreprises ont besoin de rendre leurs applications accessibles sur le web.

SOAP vs. REST : choisir la bonne architecture web services

Les motivations sont multiples : élargir l’audience des utilisateurs, vendre des services en ligne, faire communiquer des applications existantes ou supporter une interface de type AJAX. Dans ces conditions, quelle architecture choisir ou concevoir ? Quel format utiliser pour échanger des données sur le web ? Et devrait-on utiliser un protocole applicatif existant ou développer un protocole adapté à nos besoins ? Table des matières Introduction Nous parlons ici de mettre en place un protocole applicatif sur le web pour échanger de l’information avec un grand nombre de clients. Le développement de protocoles applicatifs. Need 11 reasons to love jade template engine? Look no further! Problem Node.js is based on event-driven IO.

Need 11 reasons to love jade template engine? Look no further!

Accessing file system, data base, network, ... happens in most cases asynchronously. If calls depend on each other, you have to synchronize, this often ends up in deeply nested spaghetti code. If you have a couple of async function calls where one depends on the result of the other, you may end up with something like this: And if you add exception handling and need additional steps, code will become unmaintainable. What is the difference between __dirname and ./ in node.js. Jade Template Syntax Documentation by Example. Webapplications with node.js – Jade. In my previous post I described how you can install node.js and how to use express.js to create a webapplication for the node.js server.

Webapplications with node.js – Jade

Now it is time to look into the templating engine – Jade – that express uses for outputting html to the browser. As I did not have any knowledge yet of jade, it was time for me to do a quick study of jade. As a lot of github projects, the initial documentation is rather sparse, since it only showed an example of the jade template language will be translated into html. But luckily clicking on the github fork ribbon showed some more documentation on github.

Basically it looked pretty easy, it’s just html with indentation meaning something and with all the >’s and <’s. replaced by ‘(‘ and ‘)’. Starting. Webapplications with node.js – Jade. Jade – Node Template Engine. Coming from a strong php background, where the back-end is integrated into the front end, I immediately opened my arms towards Jade. Don’t get me wrong, there are templating engines such as Smarty and Mustache (PHP & JS). It has made creating views for data to be a lot easier than I remembered in stock php. I don’t know why I never went further than using Mustache in my career. It is currently ranked 12th (as of 22/10/2013) in the Most Depended-upon Packages on the official NPM website. Installation $ npm install jade Since we’re dealing with Node and NPM, installation is practically effortless. How to use it. Jade tutorial. Créer un site simple avec Node.js, Express et Jade - Code4fun - Dev Blog.

Express est un framework permettant de créer des applications web avec nodejs. Dans cette article nous allons développer un mini site basé sur le framework Express et son moteur de template par defaut : Jade (Voir la demo). Certains sites à fort trafic utilisent déjà Express en production comme : Pour la suite de l’article vous devez disposer du gestionnaire de paquet NPM ainsi que d’un environnement nodejs. CRUD Introduction — MongoDB Manual 2.4.8.

MongoDB stores data in the form of documents, which are JSON-like field and value pairs. Documents are analogous to structures in programming languages that associate keys with values, where keys may hold other pairs of keys and values (e.g. dictionaries, hashes, maps, and associative arrays). Formally, MongoDB documents are BSON documents, which is a binary representation of JSON with additional type information. For more information, see Documents. A MongoDB document. MongoDB stores all documents in collections. Password-hash. Node-password-hash password-hash is a node.js library to simplify use of hashed passwords. Storing passwords in plain-text is bad. This library makes the storing of passwords (and subsequent validation of) hashed passwords a bit easier. Installation et bases de MongoDB - Syrinxoon Tuts. MongoDB est l'une des bases de données composant le mouvement NoSQL au même titre que qu'Apache CouchDB pour ne citer qu'elle.

L'intérêt de ce genre de bases de données se ressent dans la manipulation de très grosses bases de données où le temps de réponse compte plus que l'intégrité des données. En effet, les bases NoSQL sont des SGBD et laissent ainsi tomber le R de relationnel au profit d'une plus grande simplicité, performance et montée en charge. NodeJS by Example. I prefer not to write blog post showing coding samples. They tend to go stale and lose relevance quickly. Instead, I publish sample apps to GitHub with pretty damn good documentation. You can pull these apps down, build and run them yourself. Introduction to Node.js with Ryan Dahl. Jade - Template Engine.

Passport - Simple, unobtrusive authentication for Node.js. 10 Node.js Modules You May Not Know About. As Node.js continues to rise in popularity and the number of modules on npm rapidly increase it becomes harder and harder to keep up with the useful and unique modules. So in order to make it a little easier I've compiled a list of some of the great Modules you might not know about. Npm cheatsheet - Npm is the node package manager. It helps you manage your node.js modules and dependencies. Here is a quick cheatsheet of all my favorite npm commands: Installing npm curl | sh Update npm There are several ways you can update npm. A Sample App with Node.js, Express and MongoDB – Part 1. In this post, we’re going to be creating a simple Employee database using Node, Express and MongoDB. By the end of this tutorial, you should be able to save a new employee and display all saved employees.

Getting StartedMongoDB Installation and configuration of MongoDB is beyond the scope of this post. The Node Beginner Book » A comprehensive Node.js tutorial. About. Introduction to npm. Static Version. Mot-clé - package.json. The cross-browser WebSocket for realtime apps.