Book Image

Mastering Web Application Development with Express

By : Alexandru Vladutu
Book Image

Mastering Web Application Development with Express

By: Alexandru Vladutu

Overview of this book

Table of Contents (18 chapters)
Mastering Web Application Development with Express
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Error handling in a practical application


For the remainder of this chapter, we will create a sample microblogging application from scratch with error handling included.

Guests should be able to register, log in, and publish posts on the home page of the application. Everybody should be able to view published posts (from newest to oldest) and new post notifications should be sent in real time to the web interface. A counter will display the number of posts that have been published since viewing the page, and there will be a button for the users who want to load them.

We will use the following modules:

  • mongoose: This module will be used for the database layer (thus, MongoDB as the database)

  • EJS: This module will be used for rendering views

  • passport-local-mongoose: This module will be used to help us with the user registration/authentication

  • primus: This module will be used to manage real-time updates (server and browser)

We will also reuse the error handler created earlier in this chapter, and...