background preloader

Node JS

Facebook Twitter

Keeping Your NodeJS Web App Running on Production Linux. All the following offerings that I’ve evaluated target different scenarios.

Keeping Your NodeJS Web App Running on Production Linux

I’ve listed the pros and cons for each of them and where I think they fit into a potential solution to monitor your web applications (I’m leaning toward NodeJS) and make sure they keep running. Implement Access Control in Node.js — Security and Node.js — Medium. Most web applications rely on some sort of access control to keep users from accessing information not meant for them.

Implement Access Control in Node.js — Security and Node.js — Medium

If authentication is a lock on the main door of the hotel, then access control is the individual access card they give to each user for accessing their room. We have spent quite a few posts talking about various theories about security mechanisms for a web application. In this blog post we will not stop at theory, but will take a more hands on approach to helping the community secure the web by building a RBAC module from the ground up that we can use to check our user's privileges.

We'll begin by going over the theory of access control then proceed with incrementally building it. How to not break the internet with this one weird trick. How to not break the internet with this one weird trick If you write JavaScript tools or libraries, you should bundle your code before publishing.

How to not break the internet with this one weird trick

A few hours ago, Azer Koçulu ‘liberated’ his collection of modules from npm following a trademark dispute. One of them — an 11-line utility for putting zeroes in front of strings — was heavily depended on by other modules, including Babel, which is heavily depended on by the entire internet. And so the internet broke. People confirmed their biases: People panicked: And people got angry: Незащищённость NPM к атакам по внедрению вредоносных модулей-червей. Async Fragments: Rediscovering Progressive HTML Rendering with Marko. At eBay, we take site speed very seriously and are always looking for ways to allow developers to create faster-loading web apps.

Async Fragments: Rediscovering Progressive HTML Rendering with Marko

This involves fully understanding and controlling how web pages are delivered to web browsers. Progressive HTML rendering is a relatively old technique that can be used to improve the performance of websites, but it has been lost in a whole new class of web applications. The idea is simple: give the web browser a head start in downloading and rendering the page by flushing out early and multiple times. Browsers have always had the helpful feature of parsing and responding to the HTML as it is being streamed down from the server (even before the response is ended). This feature allows the HTML and external resources to be downloaded earlier, and for parts of the page to be rendered earlier. To see the techniques discussed in this post in action, please take a look at the accompanying sample application. Background. Your First GraphQL Server. So, today we’re going to write a small GraphQL server.

Your First GraphQL Server

I’m not going to try to persuade you to drop everything and adopt GraphQL — but if you’re curious about what this stuff looks like today and how it works, read on. Setup an HTTP Server We need a server to receive our GraphQL queries. There’s nothing in the GraphQL spec that demands we do this over HTTP, but since the GraphQL reference implementation is in JavaScript, it’s expedient to roll a quick HTTP server with Express. Hidemyass. Icodeforlove/node-requester. Production-Quality Node.js Web Apps : Part I, The Basics -

I’ve been working on production-quality node.js web applications for a couple of years now, and I thought it’d be worth writing down some of the more interesting tricks that I’ve learned along the way.

Production-Quality Node.js Web Apps : Part I, The Basics -

I’m mostly going to talk about maintaining a low-defect rate and high availability, rather than get into the details about scaling that are covered in a lot of other places. What’s New in Node.js v0.12: Cluster Round-Robin Load Balancing. Editor’s Note Welcome to the first installment of what will likely be a seven or eight part series of blog posts authored by Node core commiters, Ben Noordhuis and Bert Belder, covering the new features currently slated for inclusion in v0.12 of Node.js.

What’s New in Node.js v0.12: Cluster Round-Robin Load Balancing

In this first post, Ben looks at the new round-robin clustering algorithm. Recap: Node’s built-in cluster module In the days of yore, an oft-lamented limitation of Node.js was its intrinsically single-threaded model. BDD with MEAN – The Server Part 1. As with any new endeavor, it pays to spend some time trying various solutions out and sometimes failing miserably.

BDD with MEAN – The Server Part 1

This is especially true for us progressive nerds who like to live on the bleeding edge without things like Stack Overflow to constantly save our ass. What I’d like to do is to help you avoid going through the pain of figuring out what works and what doesn’t. As I mentioned in my previous post, I already have a project that serves as a working example of if you wish to jump straight into the code: . All of the gists used in this post were pulled from that project. The first step on our journey to effective BDD testing with the MEAN stack will be to start wiring up the various tools we’ll need to use to get a working environment. Top 10 Mistakes Node.js Developers Make. Node.js in Flames. We’ve been busy building our next-generation web application using Node.js.

Node.js in Flames

You can learn more about our approach from the presentation we delivered at a few months ago. Today, I want to share some recent learnings from performance tuning this new application stack. We were first clued in to a possible issue when we noticed that request latencies to our Node.js application would increase progressively with time. The app was also burning CPU more than expected, and closely correlated to the higher latency. While using rolling reboots as a temporary workaround, we raced to find the root cause using new performance analysis tools and techniques in our Linux EC2 environment. Node OS. What Makes Node.js Faster Than Java? Every few weeks someone posts a Java vs Node benchmark, like PayPal’s or Joey Whelan’s.

What Makes Node.js Faster Than Java?

As one of maintainers of Node core and contributors to many npm modules, StrongLoop is happy to see Node winning lately. Everyone knows benchmarks are a specific measurement and don’t account for all cases. Sometimes Java is faster. Sometimes Node is. Full Stack JavaScript: Backbone, Node, Express & More. The Story So, you and your co-founder have this great idea for a business, right? You’ve been adding features in your mind. Frequently, you ask potential customers for their opinions, and they all love it. Why Use Node.js? A Comprehensive Tutorial with Examples.

Introduction JavaScript’s rising popularity has brought with it a lot of changes, and the face of web development today is dramatically different. The things that we can do on the web nowadays with JavaScript running on the server, as well as in the browser, were hard to imagine just several years ago, or were encapsulated within sandboxed environments like Flash or Java Applets. Before digging into Node.js, you might want to read up on the benefits of using JavaScript across the stack which unifies the language and data format (JSON), allowing you to optimally reuse developer resources. 10 steps to nodejs nirvana in production. We have been using node.js in production environments since a few years now, back when it was still in 0.4. We have used node for ecommerce, for ad-serving, as an API server and just about everything else, short of calculating the nth fibonacci number (we use GO for that sort of stuff, no kidding).

When you run stuff in production, and at scale, there are lessons to be learned and insights to be gleaned, sometimes the hard way. This is a compilation of certain learnings that work for us, listed here in the hope that someone may find it useful. YMMV. For the impatient, here is the tl;dr Don’t reinvent the wheel, follow the unix way of doing things. As with any high availability system, you need to make sure that your node process is up all the time, and it starts at boot time.

Code.tutsplus. Koa.js is an expressive next-generation web framework written for Node.js by the people behind the Express and Connect frameworks. Koa.js leverages generators, which are a bleeding edge feature of JavaScript, and have not yet been made into stable versions of Node.js. Koa aims to use generators to save developers from the spaghetti of callbacks, making it less error-prone and thus more manageable.

With just 550 lines of code, Koa is an extremely light framework. Even after that, Koa packs in an elegant suite of methods such as content-negotiation, redirections, proxy support etc., giving you ease and speed of development along with the granular control over your node application. Node.js in Production. When running a node application in production, you need to keep stability, performance, security, and maintainability in mind. Outlined here is what I think are the best practices for putting node.js into production. By the end of this guide, this setup will include 3 servers: a load balancer (lb) and 2 app servers (app1 and app2).

The load balancer will health check and balance traffic between the servers. The app servers will be using a combination of systemd and node cluster to load balance and route traffic around multiple node processes on the server. Deploys will be a one-line command from the developer’s laptop and cause zero downtime or request failures. It will look roughly like this: Fully Loaded Node – A Node.JS Holiday Season, part 2. Lloyd/node-compute-cluster. Why you should use Node.js for CPU-bound tasks - Neil Kandalgaonkar. In the first part of this discussion, I discussed the algorithms behind the Node.js-based Letterpress solver I wrote, called LetterPwn (source). JXcore – A Node.JS Distribution with Multi-threading. By Krzysztof Trzeciak. Dandean/express-form. Building A Node.JS Server That Won’t Melt – A Node.JS Holiday Season, part 5.


Modules. Frameworks. Node.js. Npm. Полезные инструменты, туториалы и ресурсы. Modules · joyent/node Wiki. Nodejs_resource.markdown. Impress. Impress: многоцелевой сервер приложений для Node.js. Несмотря на заметные успехи, Node.js все еще остается специализированной технологией, которой преимущественно закрывают узкие места в системах, написанных в другом стеке технологий. Причина такого положения кроется в том, что сама по себе нода не имеет многих библиотек, к которым мы привыкли на других языках и которые обеспечивают быструю разработку именно прикладного ПО. Например, для того, чтобы разделить в коде обработчики разных URL, отдавать статические файлы, организовывать сессии, запускать нескольких потоков, иметь доступа к БД, кешировать данные в памяти, разграничивать права пользователей, иметь логи и ротировать их, создавать сетевое API, рендерить шаблоны, настраивать URL-реврайтинг, обеспечивать быструю доставку событий с сервера на клиенты, для всего этого, и многих других задач, используются отдельные библиотеки (модули).

Monolithic Node.js. DailyJS: A JavaScript Blog. (99+) nodejs – Группы Google. Unix Philosophy and Node.js.