Book Image

MEAN Web Development

By : Haviv
Book Image

MEAN Web Development

By: Haviv

Overview of this book

The MEAN stack is a collection of the most popular modern tools for web development; it comprises MongoDB, Express, AngularJS, and Node.js. Starting with MEAN core frameworks, this project-based guide will explain the key concepts of each framework, how to set them up properly, and how to use popular modules to connect it all together. By following the real-world examples shown in this tutorial, you will scaffold your MEAN application architecture, add an authentication layer, and develop an MVC structure to support your project development. Finally, you will walk through the different tools and frameworks that will help expedite your daily development cycles. Watch how your application development grows by learning from the only guide that is solely orientated towards building a full, end-to-end, real-time application using the MEAN stack!
Table of Contents (13 chapters)
12
Index

The application, request, and response objects


Express presents three major objects that you'll frequently use. The application object is the instance of an Express application you created in the first example and is usually used to configure your application. The request object is a wrapper of Node's HTTP request object and is used to extract information about the currently handled HTTP request. The response object is a wrapper of Node's HTTP response object and is used to set the response data and headers.

The application object

The application object contains the following methods to help you configure your application:

  • app.set(name, value): This is used to set environment variables that Express will use in its configuration.

  • app.get(name): This is used to get environment variables that Express is using in its configuration.

  • app.engine(ext, callback): This is used to define a given template engine to render certain file types, for example, you can tell the EJS template engine to use HTML...