background preloader

Code Intéressant

Facebook Twitter

MEAN Stack Tutorial MongoDB ExpressJS AngularJS NodeJS (Part III) - Adrian Mejia’s Blog. This is the last part of three-series tutorial.

MEAN Stack Tutorial MongoDB ExpressJS AngularJS NodeJS (Part III) - Adrian Mejia’s Blog

We are going to build a full-stack Todo App using the MEAN (MongoDB, ExpressJS, AngularJS and NodeJS). Brief Background TL; DR: NodeJS has been built from bottom up a non-blocking I/O paradigm, which gives you more efficiency per CPU core than using threads in other languages like Java. Get started here. LAMP (Linux-Apache-MySQL-PHP) has dominated web application stack for many years now. (Image from Why MEAN stack then? Ubiquitous Well, it turns out, that JavaScript it is everywhere: smartphones, computers, in the browser, in the server, robotics, Arduino, RaspberryPi and growing. Non-blocking architecture JavaScript is a dynamic, object-oriented, and functional scripting language. Image from Some companies like Paypal moved from Java backend to NodeJS and reported a increased performance, lower average response times, and development speed gains.

Agile and vibrant community Setup. Creating RESTful APIs With NodeJS and MongoDB Tutorial (Part II) - Adrian Mejia’s Blog. Welcome to this RESTful API using Node.js (Express.js) and MongoDB (mongoose) tutorial.

Creating RESTful APIs With NodeJS and MongoDB Tutorial (Part II) - Adrian Mejia’s Blog

You can follow alone to make a stand alone API endpoint, or you could also check out our AngularJS or BackboneJS tutorials to build a javascript-client that connects with the endpoint we are going to built. What RESTful API really means? REST stands for Representational State Transfer. It is an architecture that allows client-server communication through a uniform interface. They are also stateless, cachable and has property called idempotence, which means that the side effect of multiple identical requests have the same effect as the same single request.

HTTP RESTful API’s are compose of: HTTP methods, e.g. Here’s is a summary what we want to implement: NOTES: * Format will be JSON. * Bulk updates and bulk destroys are not safe, so we will not be implementing those. * POST, GET, PUT, DELETE == CREATE, READ, UPDATE, DELETE == CRUD. Setup The two main components of the MEAN stack are… NodeJS and MongoDB. Token-Based Authentication With AngularJS & NodeJS. Postgres LISTEN / NOTIFY with Node.js - Coding by Björn Gylling. I'm sure most of you have been hearing about Node.js lately, it has been causing quite a buzz.

Postgres LISTEN / NOTIFY with Node.js - Coding by Björn Gylling

If you're wondering what Node.js is all about I recommend you watch one of Ryan Dahls presentations on the subject. Interestingly Postgres has a feature that goes very well with the asynchronously nature of Node.js. The Postgres commands LISTEN and NOTIFY along with triggers you can have NOTIFY events fire when certain queries are performed on specific tables. I wrote a short Node.js script that basically "watches" a table in a Postgres database. Parse data files using Node.js streams - Nicolas Hery. 09 July, 2013 In this post I explain how I used Node.js streams to parse and transform data text files.

Parse data files using Node.js streams - Nicolas Hery

Streams and pipes are an important part of the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. -- Doug McIlroy, inventor of Unix pipes and one of the founders of the Unix tradition This means that we can have small, focused programs that are easily assembled together to tackle more complex problems. This is also possible in Node.js thanks to the Stream interface, and its .pipe() method. I won't go over the general aspects of streams and pipes in Unix and Node.js. During one of my projects, I had to parse text files containing data from some "legacy" system in order to make it more usable and load it into a database.

I thought this would be an ideal candidate for streams. You can follow along with the code for the example in this article at The data file to parse. Npm-stat: download statistics for NPM packages.