background preloader


Facebook Twitter

Test a Node RESTful API with Mocha and Chai. Introduction I still remember the satisfaction of being finally able to write the backend part of a bigger app in node and I am sure many of you do it too.

Test a Node RESTful API with Mocha and Chai

And then? We need to make sure our app behaves the way we expect and one of the strongly suggested methodologies is software testing. Software testing is crazily useful whenever a new feature is added to the system: Having the test environment already set up which can be run with a single command helps to figure out whether a new feature introduces new bugs. In the past, we've worked on building a RESTful Node API and authenticating a Node API. In this tutorial we are going to write a simple RESTful API with Node.js and use Mocha and Chai to write tests against it.

As usual you can build the app step-by-step throughout the tutorial or directly get it on github. Mocha: Testing Environment. Testing Node.js with Mocha and Chai. Keeping Node.js Processes Running. For-each over an array in JavaScript? How To Set Up a Node.js Application for Production on Ubuntu 14.04. Introduction Node.js is an open source Javascript runtime environment for easily building server-side and networking applications.

How To Set Up a Node.js Application for Production on Ubuntu 14.04

The platform runs on Linux, OS X, FreeBSD, and Windows, and its applications are written in JavaScript. Node.js applications can be run at the command line but we will teach you how to run them as a service, so they will automatically restart on reboot or failure, so you can use them in a production environment. In this tutorial, we will cover setting up a production-ready Node.js environment that is composed of two Ubuntu 14.04 servers; one server will run Node.js applications managed by PM2, while the other will provide users with access to the application through an Nginx reverse proxy to the application server.

The CentOS version of this tutorial can be found here. Prerequisites This guide uses two Ubuntu 14.04 servers with private networking (in the same datacenter). Here is a diagram of what your setup will be after following this tutorial: TiddlyWiki on Node.js: TiddlyWiki — a non-linear personal web notebook. How To Set Up a Node.js Application for Production on Ubuntu 14.04. Run npm command gives error "/usr/bin/env: node: No such file or directory" · Issue #3911 · nodejs/node-v0.x-archive. 3 Essential Sublime Text Plugins for Node & JavaScript developers - Scott Smith. Check out these 3 great and essential Sublime Text plugins every JavaScript and Node developer should know about and use.

3 Essential Sublime Text Plugins for Node & JavaScript developers - Scott Smith

JsFormat JsFormat is a JavaScript formatting plugin. Behind the scenes, it uses the command line formatter from to format full or portions of JavaScript and JSON files. Features JavaScript formattingJSON formattingFull file formattingSelected text formattingCustomizable settings for formatting optionsCustomize per project with .jsbeautifyrc settings file Usage Either cmd+alt+f on OS X or ctrl+alt+f on Linux/Windows JSHint “JSHint is a community-driven tool to detect errors and potential problems in JavaScript code and to enforce your team’s coding conventions.

Ctrl+j on OS X or alt+j on Linux/Windows If you would like to have JSHint run anytime you save a JavaScript file (highly suggest this), you will need to install the SublimeOnSaveBuild package. JavaScriptNext. JavaScript & NodeJS Snippets. Install To install through Package Control, search for JavaScript & NodeJS Snippets.

JavaScript & NodeJS Snippets

If you still don't have Package Control in Sublime Text, go get it. It's pure awesomeness. If you prefer to install it manually, you can download the package and put it inside your Packages directory. Package Control - the Sublime Text package manager. Easily Develop Node.js and MongoDB Apps with Mongoose. Related Course Build Your First Node.js Website Node is a powerful tool to get JavaScript on the server.

Easily Develop Node.js and MongoDB Apps with Mongoose

Use Node to build a great website. Aprende cómo crear un API REST usando Node.js, Express y MongoDB. El primer paso para implementar un sitio web moderno es la construcción de un API REST que podemos consumir desde una aplicación web, mobile o nativa.

Aprende cómo crear un API REST usando Node.js, Express y MongoDB

En éste tutorial explicaré como desarrollar servidor web que sirva una API RESTful usando para ello la tecnología de Node.js y MongoDB como base de datos. Es el llamado MEAN Stack También es una buena opción para empezar y aprender Node.js desde cero. Como framework para Node, voy a emplear Express en su versión 4.x y para conectarme a Mongo y mapear los modelos de datos, utilizaré Mongoose. Una API RESTful es aquella que emplea todos los verbos HTTP (GET, POST, PUT y DELETE mayormente) Como ejemplo para este tutorial, desarrollaré una aplicación CRUD (Create/Read/Update/Delete) que utiliza todos los verbos HTTP, para mostrar como trabaja. Vamos allá! Cambios en Express versión 4 con respecto a la versión 3.x Ya no se encuentran dentro del paquete Express y hay que importarlos como un módulo aparte si tenemos pensado utilizarlos. Write a todo list with Express and MongoDB. A todo list website is a good practice to learn a programing language or a framework.

Write a todo list with Express and MongoDB

It shows you how to create, read, update and delete records. In this post we are going to use Express as our application framework and MongoDB as our data store.