background preloader

Npm

Npm
Related:  Developpement

Things I wish I knew about MongoDB a year ago I’ve used MongoDB for over a year at scale at both Heyzap and Bugsnag and I’ve found it to be a very capable database. As with all databases, there are some gotchas, and here is a summary of the things I wish someone had told me earlier. Selective counts are slow even if indexed For example, when paginating a users feed of activity, you might see something like, In MongoDB this count can take orders of magnitude longer than you would expect. Inconsistent reads in replica sets When you start using replica sets to distribute your reads across a cluster, you can get yourself in a whole world of trouble. This is compounded if you have performance issues that cause the replication lag between a primary and its secondaries to increase to minutes or even hours in some cases. You can control whether a query is run on secondaries and also how many secondaries are replicated to during the insert, but this will affect performance and could block forever in some cases! Mongo’s BSON ID is awesome Profiler

BOWER Modules · nodejs/node-v0.x-archive Wiki This page is deprecated. Feel free to add to it, but be advised that it is, at best, a faded relic of Node modules that were written before npm was a dominant force in the Node.js ecosystem. It is not all that useful any more. If you are a newcomer, it can be handy to at least get a starting point. So, this list is long enough to be intimidating, but still only captures a tiny sliver of the Node.js modules you can use with your program. Search for modules with npmjs.org, node-modules, and nipster. The archaic contents of this once-useful page now follow. Adding to this page When you add a framework to this page, have a look at how others have done so, it should be a single item, with a link to the project's source code, and a short description (one line after formatting has been applied). If you see a module without a description, feel free to edit the page and add it in, any contributions are appreciated. Table of contents Modules Web frameworks Routers Static file servers Microframeworks Connect

Understanding node.js Node.js has generally caused two reactions in people I've introduced it to. Basically people either "got it" right away, or they ended up being very confused. If you have been in the second group so far, here is my attempt to explain node: It is a command line tool. You download a tarball, compile and install the source.It let's you run JavaScript programs by typing 'node my_app.js' in your terminal.The JS is executed by the V8 javascript engine (the thing that makes Google Chrome so fast).Node provides a JavaScript API to access the network and file system "But I can do everything I need in: ruby, python, php, java, ... !". I hear you. "Get to the point!" Alright, I will. "Huh?" That's right, everything runs in parallel, except your code. The day starts by one servant waking up the king and asking him if he needs anything. Once a servant finishes a task, he lines up outside the kings quarter to report. "That's fantastic, but could you quit the silly metaphor and speak geek to me?" Sure. No.

Connect - High quality middleware for node.js Connect is a middleware framework for node,shipping with over 18 bundled middleware and a rich selection of3rd-party middleware. var app = connect() .use(connect.logger('dev')) .use(connect.static('public')) .use(function(req, res){ res.end('hello world\n'); }) http.createServer(app).listen(3000); Installation: $ npm install connect Middleware: Links:

Alexander Luksidadi's Blog » ExpressJS without Jade? Use Underscore template! Many of you must have felt like a burden knowing that Express recommended you to learn another template language (Jade). Don’t worry, you can code all your templates on HTML using underscoreJS! Oh yay? Let’s take a look on how you implement that on your express app. First install express package, create your express app: $ npm install -g express $ express . Install your underscore package $ npm install -d underscore If you edit Now, all you need to do is, to comment out 1 line and register underscorejs: Now, go to routesindex.js : $ vi routes/index.js Change the template name from ‘index’ to ‘index.html’: Next, go to views directory and create layout.html And last, still in views directory, create another file called index.html And there you go.. you can write your HTMl code in peace =)

Grunt Crunch 2 | The editor and compiler app for awesome people. Inversion of Control Containers and the Dependency Injection pattern In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use. One of the entertaining things about the enterprise Java world is the huge amount of activity in building alternatives to the mainstream J2EE technologies, much of it happening in open source. Underlying these containers are a number of interesting design principles, things that go beyond both these specific containers and indeed the Java platform. Components and Services A Naive Example class MovieLister... Inversion of Control

Express - api reference express() Create an express application. var express = require('express'); var app = express(); app.get('/', function(req, res){ res.send('hello world'); }); app.listen(3000); Application settings The following settings are provided to alter how Express will behave: env Environment mode, defaults to process.env.NODE_ENV (NODE_ENV environment variable) or "development"trust proxy Enables reverse proxy support, disabled by defaultjsonp callback name Changes the default callback name of ? app.set(name, value) Assigns setting name to value. app.set('title', 'My Site'); app.get('title'); app.get(name) Get setting name value. app.get('title'); app.set('title', 'My Site'); app.get('title'); app.enable(name) Set setting name to true. app.enable('trust proxy'); app.get('trust proxy'); app.disable(name) Set setting name to false. app.disable('trust proxy'); app.get('trust proxy'); app.enabled(name) Check if setting name is enabled. app.enabled('trust proxy'); app.enable('trust proxy'); app.enabled('trust proxy');

Related:  DevCode BuilderstechBack-endTips front-end developpmentRepositories