Create New Express.js Apps in Minutes with Express Generator

Express.js is a Node.js web framework that has gained immense popularity due to its simplicity. It has easy-to-use routing and simple support for view engines, putting it far ahead of the basic Node HTTP server.

However, starting a new Express application requires a certain amount of boilerplate code: starting a new server instance, configuring a view engine, and setting up error handling.

Although there are various starter projects and boilerplates available, Express has its own command-line tool that makes it easy to start new apps, called the express-generator.

What is Express?
Express has a lot of features built in, and a lot more features you can get from other packages that integrate seamlessly, but there are three main things it does for you out of the box:

Routing. This is how /home /blog and /about all give you different pages. Express makes it easy for you to modularize this code by allowing you to put different routes in different files.
Middleware. If you’re new to the ..

Continue Reading

Five Ways to Lazy Load Images for Better Website Performance

With images being among the most popular type of content on the web, page load time on websites can easily become an issue.

Even when properly optimized, images can weigh quite a bit. This can have a negative impact on the time visitors have to wait before they can access content on your website. Chances are, they get impatient and navigate somewhere else, unless you come up with a solution to image loading that doesn’t interfere with the perception of speed.

In this article, you’ll learn about five approaches to lazy loading images that you can add to your web optimization toolkit to improve the user experience on your website.

What Is Lazy Loading?
Lazy loading images means loading images on websites asynchronously — that is, after the above-the-fold content is fully loaded, or even conditionally, only when they appear in the browser’s viewport. This means that if users don’t scroll all the way down, images placed at the bottom of the page won’t even be loaded.

A number of websit..

Continue Reading

The Devastating Price Developers Pay for Working Hard

You're a wonderful developer.

You come early, and you stay late. Your code is clear and well documented; you're eager to help others, and you're able to handle 3x the work your co-workers can handle.

You're an amazing developer, and that's your problem.

Your Boss and your co-workers all want your best work. It's an unspoken expectation in the workplace. No one prepares you for the horrible consequences that come with doing your job well.

The devastating price you pay for working hard
There are several unpleasant downsides that come with exceptional performance and hard work. There's one reward in particular that acts as a demotivator that destroys job satisfaction.

You're probably already familiar with it.

The reward for working hard and performing above expectations at your job is more work.

This is devastating to developers in the long term, and here are a few reasons why …

1. Price's Law becomes a dysfunctional cycle
Information ..

Continue Reading

30 Web Development Checklists Every Team Should Keep Handy

Building a website or app and making it available for the world is a complex business. A number of factors must come together to ensure the final product is successful. That means attracting and keeping visitors, meeting business goals, and minimizing problems. You can deliver a better product with the help of web development checklists.

As in everyday life, checklists can be a great organizational tool. They keep web development teams on track. They also ensure important tasks aren't overlooked in the rush to complete a project.

We searched the web for the most useful web development checklists. They cover everything from front-end and performance to SEO and marketing.

Launch (Pre-launch/Post-launch)
#1 The Essential Pre-launch Checklist for Your Website
A practical checklist that includes:

design elements to look out for before launch
functionality
cross-browser testing
SEO and content editing
#2 Website Launch Checklist
This is a nice checklist tool built by Glasgow develop..

Continue Reading

MEAN Stack: Build an App with Angular and the Angular CLI

For expert-led online Angular training courses, you can't go past Ultimate Angular by Todd Motto. Try his courses here, and use the code SITEPOINT to get 25% off and to help support SitePoint.

In this tutorial, we’re going to look at managing user authentication in the MEAN stack. We’ll use the most common MEAN architecture of having an Angular single-page app using a REST API built with Node, Express and MongoDB.

When thinking about user authentication, we need to tackle the following things:

let a user register
save user data, but never directly store passwords
let a returning user log in
keep a logged in user’s session alive between page visits
have some pages that can only been seen by logged in users
change output to the screen depending on logged in status (for example, a “login” button or a “my profile” button).
Before we dive into the code, let’s take a few minutes for a high-level look at how authentication is going to work in the MEAN stack.

The MEAN Stack Authentica..

Continue Reading

MEAN Stack: Build an App with Angular and the Angular CLI

For expert-led online Angular training courses, you can't go past Ultimate Angular by Todd Motto. Try his courses here, and use the code SITEPOINT to get 25% off and to help support SitePoint.

In this tutorial, we’re going to look at managing user authentication in the MEAN stack. We’ll use the most common MEAN architecture of having an Angular single-page app using a REST API built with Node, Express and MongoDB.

When thinking about user authentication, we need to tackle the following things:

let a user register
save user data, but never directly store passwords
let a returning user log in
keep a logged in user’s session alive between page visits
have some pages that can only been seen by logged in users
change output to the screen depending on logged in status (for example, a “login” button or a “my profile” button).
Before we dive into the code, let’s take a few minutes for a high-level look at how authentication is going to work in the MEAN stack.

The MEAN Stack Authentica..

Continue Reading

How Aaron Osteraas Made the Content to Code Career Transition

As Aaron Osteraas can tell you, the path between discovering what you want to do for a living and actually doing it is rarely linear.

Now a Software Engineer at Tigerspike, a digital services company headquartered in Sydney, Aaron’s journey toward becoming a developer began when he was in high school, yet it wasn’t until his early 30s that he obtained his first full-time development job. The years in between were filled with starts and stops, challenges and successes, and a whole lot of tinkering.

“I was always tinkering with the family computer, which was mostly, ‘oh god I've broken it how do I fix it before I get in trouble,’” Aaron said of his technical beginnings. He had an appetite for building and modifying hardware, which he attributes to the joy that comes from doing something with your hands. He’d collect spare hardware, buy and sell parts, and at times resort to scrounging and trading. “There were computer parts strewn everywhere,” he said.

But by the time he graduate..

Continue Reading

The Ultimate ADA Compliance Guide

This article was created in partnership with Inbound Junction. Thank you for supporting the partners who make SitePoint possible.

Based on web accessibility data, the ADA compliance-related lawsuits reached over 2,000 cases in 2019. ADA Compliance is Mandatory for Digital Agencies. The challenge, however, is knowing how to build and design ADA-compliant websites. That’s the problem we’ll help you address in this post.

In this ultimate ADA compliance guide, we’ve laid out the things your web design agency needs to know to make accessible websites.

The number of lawsuits will only keep growing if website owners, developers, and agencies continue to be non-compliant with the ADA.

If you don’t want to be a part of that statistic, you’ll need to ensure that your agency and client websites offer accessibility to persons with disabilities and adhere to ADA standards.

What is the ADA, anyway?
The Americans with Disabilities Act is a civil rights law that was enacted in 1990 to prohibit di..

Continue Reading

Build a Node.js CRUD App Using React and FeathersJS

Building a modern project requires splitting the logic into front-end and back-end code. The reason behind this move is to promote code re-usability. For example, we may need to build a native mobile application that accesses the back-end API. Or we may be developing a module that will be part of a large modular platform.

The popular way of building a server-side API is to use Node.js with a library like Express or Restify. These libraries make creating RESTful routes easy. The problem with these libraries is that we'll find ourselves writing a ton of repetitive code. We'll also need to write code for authorization and other middleware logic.

To escape this dilemma, we can use a framework like Feathers to help us generate an API in just a few commands.

What makes Feathers amazing is its simplicity. The entire framework is modular and we only need to install the features we need. Feathers itself is a thin wrapper built on top of Express, where they've added new feature..

Continue Reading

How to Debug a Node.js Application: Tips, Tricks and Tools

Software development is complex and, at some point, your Node.js application will fail. If you’re lucky, your code will crash with an obvious error message. If you’re unlucky, your application will carry on regardless but not generate the results you expect. If you’re really unlucky, everything will work fine until the first user discovers a catastrophic disk-wiping bug.

What is Debugging?
Debugging is the black art of fixing software defects. Fixing a bug is often easy — a corrected character or additional line of code solves the problem. Finding that bug is another matter, and developers can spend many unhappy hours trying to locate the source of an issue. Fortunately, Node.js has some great tools to help trace errors.

Terminology
Debugging has its own selection of obscure jargon, including the following:

Term
Explanation
breakpoint
the point at which a debugger stops a program so its state can be inspected
debugger
a tool which offers debugging facilities such as running code lin..

Continue Reading