background preloader

New

Facebook Twitter

Create a Trello Clone using Angular, Node.js, Mongo, and Express. Table of contents.

Create a Trello Clone using Angular, Node.js, Mongo, and Express

A quick guide to JavaScript Promises. As you can see, we pass in the callback function as a second argument to request.get call.

A quick guide to JavaScript Promises

The library will automatically execute this function when the response for the HTTP request comes in. It will pass three arguments. The first argument is the potential error or null if it was successful. The second argument is the HTTP response and the third argument is the response body. If we use fetch instead of the request.get we can leverage Promises as fetch will return a Promise instead of accepting a callback as a second argument. For then(), the first function argument is called if the result of the call was successful.

Replace the previous code with the following to start using Promises: Post-mortem Debugging and Promises. September 26, 2016 - by Wyatt Lyon Preul Share: Over the years there has been an increase in the popularity of promises in Node.js and JavaScript in general.

Post-mortem Debugging and Promises

This popularity is evidenced by the Promise object becoming part of the ECMAScript specification. As a result of having promises built-in, the language can add new capabilities that rely on them. Node, Passport, and Postgres - Michael Herman. This tutorial takes a test-first approach to implementing authentication in a Node app using Passport and Postgres.

Node, Passport, and Postgres - Michael Herman

Contents ObjectivesProject SetupDatabase SetupPassport ConfigPassport Local ConfigPassword HashingAuth RoutesValidation. Node.js debugging with Chrome DevTools (in parallel with browser JavaScript) Recently Paul Irish described how you can debug Node.js applications with Chrome DevTools.

Node.js debugging with Chrome DevTools (in parallel with browser JavaScript)

Since that time Chrome DevTools have evolved and the step, where you had to open the separate page with a specific URL to debug the Node.js code, was removed. It means, today you can debug your browser JavaScript files and Node.js ones in the same DevTools window in parallel, which makes the perfect sense. Node.js at Scale - npm Best Practices. Learn Node.js - A Free Course for Node Beginners - Words from HyperDev. Learn Node.js - A Free Course for Node Beginners - Words from HyperDev. Building and Securing a Modern Backend API. Try TypeScript in your NodeJS project.

Try TypeScript in your NodeJS project If you are working on a NodeJS project… You should try Typescript.

Try TypeScript in your NodeJS project

Why? Your JS code is still validYou add type inference to your codeYou have type validation for a lot of existing libraries Install TypeScript and Typings globally npm install typescript@next typings -g TypeScript is the compiler, while Typings is the CLI for installing typings for the existing JS libraries. Execute the following command to initialise your TypeScript project in the folder where you already have a NodeJS one. Developing Node.js App Services in TypeScript – part 1 of n: Introduction. – Epikia. I suppose there are not so many people who do not know what Node.js is.

Developing Node.js App Services in TypeScript – part 1 of n: Introduction. – Epikia

You may love it, you may hate it, but you cannot deny the fact that more and more enterprises are using it to replace some parts of their system, previously written in Java, Rails or .Net. Node.js runs in a lot of environments – starting from large, multi-core servers, through laptops, then microcomputers like Rasperry Pi, finishing on IoT devices. Thanks to it, JavaScript became the language used both on client-side and on the server-side, and to make it more tangled – both those ‘sides’ intermingle forming what is now called Universal / Isomorphic Applications.

Another positive aspect is performance – the advantages of using async I/O are well described through the Internet, so I will not repeat it here once again ( How to Create a React.js Support Ticketing System Using MongoDB. In the last article I wrote we talked about how to create a Redux-Form inside a React/Redux application.

How to Create a React.js Support Ticketing System Using MongoDB

Now I want to put that form to work for us, and create a simple support ticketing system using a Node.js/Express server and Mongoose to talk to a MongoDB. This will get us some good working knowledge of how to use Redux-Form, but more importantly, we'll work with Mongoose and API's in general. Warning: This tutorial only covers specific elements of the MERN stack process. As such it won't go into much detail on actions, action types, reducers, or even Redux and React. What this tutorial will do is show you how to use Mongoose to save information into a MongoDB and use Axios to send information from your client to your API. You'll be able to view the entire tutorial at this gist. What do we need to get started? Building a Hotel Booking App with Ionic 2, MongoDB & Node. A short while ago I wrote a tutorial on how to build a review application in Ionic 2 with the MEAN (MongoDB, Express.js, Angular, and Node.js) stack.

Building a Hotel Booking App with Ionic 2, MongoDB & Node

Although this was a reasonably advanced tutorial, since it also served as an introduction to MongoDB and creating a backend with Node I kept the application itself pretty simple. In this tutorial we are going to build a fully featured hotel room booking application in Ionic 2, which will allow users to: Search for rooms based on search criteriaView only rooms that are not booked out for the date range they are booking forSee descriptions of roomsBook a room (which will then make it unavailable to other users for that date range)

Setting up Cucumber.js, WebDriverIO and Chai.js to test your Single-Page Applications. 6 min read Testing JavaScript applications with Cucumber and Selenium WebDriver is very common when the API is written in Rails.

Setting up Cucumber.js, WebDriverIO and Chai.js to test your Single-Page Applications

After all, you write it in Ruby and have direct access to the database, stubs on global classes and other goodies. Testing HTTP APIs With Supertest. You know tests are good for you. You probably even write unit tests and measure the code coverage of your business logic. Congrats! However, at that layer, you're only writing tests for yourself, your teammates, or others consuming your code-level interfaces. Transactions in Microservices - DZone Cloud. Download the Essential Cloud Buyer’s Guide to learn important factors to consider before selecting a provider as well as buying criteria to help you make the best decision for your infrastructure needs, brought to you in partnership with Internap.

A microservice does a business unit of work. Transaction boundaries in most cases will span a business unit of work; hence, the transactions are automatically contained within a service. For example, a "debit savings bank account" operation can be atomic and transaction integrity can be ensured as that operation is within the boundary of service. However, there are business scenarios that require you to run business units of work across multiple services, written by different teams in different domains. Since such orchestration spans across boundaries of multiple services, ensuring transaction integrity is a challenge. Compensating Transactions. Express 4.x OAuth and Local Authentication with Passport.js: Pt 1. Express 4.x OAuth and Local Authentication with Passport.js: Pt 1 In today’s article, we will pull together a number of previously reviewed concepts as well as explore new ground as we cover OAuth and Local Authentication in Express 4.x using Passport.js.

The full code can be found at . Testing APIs with Mocha. Testing APIs with Mocha Creating automated tests is something highly recommended. There are several types of tests: unitary,functional, integration and others. In this chapter, we will focus only on the integration tests. In our case we aim to test the outputs and behaviors of the API routes. Creating an API with Express. One weird trick that will change the way you code forever: JavaScript TDD. This is a presentation delivered to the Squiz Melbourne Engineering team. It repeats some of the material I’ve covered in other posts. JavaScript Object Creation: Patterns and Best Practices. In this article, I’m going to take you on a tour of the various styles of JavaScript object creation, and how each builds on the others in incremental steps.

JavaScript has a multitude of styles for creating objects, and newcomers and veterans alike can feel overwhelmed by the choices and unsure which they should use. But despite the variety and how different the syntax for each may look, they’re more similar than you probably realize. Object Literals The first stop on our tour is the absolute simplest method of JavaScript object creation — the object literal. JavaScript touts that objects can be created “ex nilo”, out of nothing — no class, no template, no prototype — just poof! Let’s Code: Test-Driven JavaScript. A TDD Approach to Building a Todo API Using Node.js and MongoDB - Semaphore. Mongoose models and unit tests: The definitive guide. A TDD Approach to Building a Todo API Using Node.js and MongoDB - Semaphore. Node.js Tutorial – Step-by-Step Guide For Getting Started.

Node.js: Step by Step - Envato Tuts+ Code Tutorials. Felix's Node.js Beginners Guide. « Home / All Guides There is lots of information about node.js, but given the rapid pace at which it is developing, it can be difficult for beginners to find good, current information on how to get started.