Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MongoDB, Express, Angular, and Node.js Fundamentals

You're reading from   MongoDB, Express, Angular, and Node.js Fundamentals Become a MEAN master and rule the world of web applications

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher
ISBN-13 9781789808735
Length 362 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Paul Oluyege Paul Oluyege
Author Profile Icon Paul Oluyege
Paul Oluyege
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

MongoDB, Express, Angular, and Node.js Fundamentals
Preface
1. Introduction to the MEAN Stack FREE CHAPTER 2. Developing RESTful APIs to Perform CRUD Operations 3. Beginning Frontend Development with Angular CLI 4. The MEAN Stack Security 5. Angular Declarables, Bootstrapping, and Modularity 6. Testing and Optimizing Angular Applications Appendix

Getting Started with Express


Express provides a robust set of features for building web applications. In the first chapter, we briefly talked about Express.js, and discussed its advantages and limitations. This topic is about the implementation of Express in an application.

Creating an Express application requires the following steps:

  1. Importing the Express module

  2. Creating the Express application

  3. Defining the route

  4. Listening to the server

Take a look at the following example in Express:

// load express module
var express = require('express');

//Create express app
var app = express();

// route definition
app.get('/', function (req, res) {
res.send('Hello World');
});

// Start server
app.listen(4000, function () {
    console.log('App listening at Port 4000..');
});

In the preceding code snippet, the Express module is first loaded and assigned to a variable. Then, an app is created using the variable function. The app.get() method is used to define the route by passing in a route path and a callback...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image